FIX: Ajustado status de completed para uso correto do banco de dados
This commit is contained in:
parent
53bdd1c5a5
commit
fa6931a5bb
@ -6,7 +6,7 @@ const runWatchdog = require('../../modules/watchdog/job/job')
|
|||||||
|
|
||||||
logInfo('[CRON] 🐶 Watchdog cron iniciado')
|
logInfo('[CRON] 🐶 Watchdog cron iniciado')
|
||||||
|
|
||||||
cron.schedule('*/30 * * * *', async () => {
|
cron.schedule('*/5 * * * *', async () => {
|
||||||
logInfo('[CRON] 🐶 Watchdog executando verificação')
|
logInfo('[CRON] 🐶 Watchdog executando verificação')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -137,7 +137,7 @@ async function markNotificationsAsCompleted(hubsoftTicketIds, type = 'func') {
|
|||||||
|
|
||||||
if (ids.length === 0) return;
|
if (ids.length === 0) return;
|
||||||
|
|
||||||
const status = buildStatus('completed', type);
|
const status = buildStatus('end', type);
|
||||||
const query = `
|
const query = `
|
||||||
INSERT INTO watchdog_notifications (ticket_id, notified_at, status)
|
INSERT INTO watchdog_notifications (ticket_id, notified_at, status)
|
||||||
SELECT
|
SELECT
|
||||||
@ -153,12 +153,11 @@ async function markNotificationsAsCompleted(hubsoftTicketIds, type = 'func') {
|
|||||||
try {
|
try {
|
||||||
await db.query(query, [ids, status]);
|
await db.query(query, [ids, status]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logError('[WATCHDOG][REPOSITORY] Erro ao marcar notificaÇÎÇæÇÎÇÝes como concluido', error);
|
logError('[WATCHDOG][REPOSITORY] Erro ao marcar notificação como concluido', error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function getPendingTicketsForNotification(type = 'func') {
|
async function getPendingTicketsForNotification(type = 'func') {
|
||||||
const status = buildStatus('pending', type);
|
const status = buildStatus('pending', type);
|
||||||
const query = `
|
const query = `
|
||||||
|
|||||||
@ -117,10 +117,6 @@ async function getTicketsClosedSince(thresholdDate) {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const mundialeUserId = process.env.HUBSOFT_MUNDIALE_USER_ID;
|
const mundialeUserId = process.env.HUBSOFT_MUNDIALE_USER_ID;
|
||||||
|
|
||||||
if (!mundialeUserId) {
|
if (!mundialeUserId) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user