HOTFIX: Alinhado a exportação do JOB
This commit is contained in:
parent
55ef702141
commit
0b1d5f5a30
@ -5,7 +5,7 @@ loadEnv()
|
|||||||
|
|
||||||
const cron = require('node-cron')
|
const cron = require('node-cron')
|
||||||
const {logError, logInfo} = require('../../shared/utils/logger')
|
const {logError, logInfo} = require('../../shared/utils/logger')
|
||||||
const runWatchdog = require('../../modules/watchdog/job/job')
|
const {runWatchdog} = require('../../modules/watchdog/job/job.js')
|
||||||
|
|
||||||
logInfo('[CRON] 🐶 Watchdog cron iniciado')
|
logInfo('[CRON] 🐶 Watchdog cron iniciado')
|
||||||
|
|
||||||
@ -15,7 +15,8 @@ cron.schedule('*/5 * * * *', async () => {
|
|||||||
try {
|
try {
|
||||||
await runWatchdog()
|
await runWatchdog()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logError('[CRON] ❌ Erro no Watchdog', { error })
|
logError(`[CRON] ❌ Erro no Watchdog: ${error?.message || error}`)
|
||||||
|
if (error?.stack) logError(error.stack)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// src/modules/watchdog/job/job.js
|
// src/modules/watchdog/job/job.js
|
||||||
|
|
||||||
const { logError, logInfo } = require('../../../shared/utils/logger')
|
const { logInfo } = require('../../../shared/utils/logger')
|
||||||
const { notifyCollaborators } = require('../services/notifyCollaborators.service.js')
|
const { notifyCollaborators } = require('../services/notifyCollaborators.service.js')
|
||||||
const { notifyAdmins } = require('../services/notifyAdmins.service.js')
|
const { notifyAdmins } = require('../services/notifyAdmins.service.js')
|
||||||
|
|
||||||
@ -11,8 +11,5 @@ async function runWatchdog() {
|
|||||||
logInfo(`[WATCHDOG] [JOB] Enviadas ${sentFunc} notificacoes para colaboradores e ${sentAdm} para ADM.`)
|
logInfo(`[WATCHDOG] [JOB] Enviadas ${sentFunc} notificacoes para colaboradores e ${sentAdm} para ADM.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
runWatchdog().catch((error) => {
|
|
||||||
logError('[WATCHDOG] [JOB] Erro ao executar o job do Watchdog', error)
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = { runWatchdog }
|
module.exports = { runWatchdog }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user