Improve queue management error handling

This commit is contained in:
Dominic Ferrando
2026-07-12 01:56:56 -04:00
parent 8b81156f6c
commit 4d1b3bc3ef
2 changed files with 12 additions and 5 deletions
+10 -5
View File
@@ -321,11 +321,16 @@ app.listen(3000, async () => {
for (const queue of queues) {
(async () => {
while (true) {
// clean, if ready
if ((Date.now() - queue.lastCleanDate.getTime()) >= queue.cfg.concurrency.timeoutMs)
await queue.clean().catch((err) => log.error(err));
// drain
await queue.drain().catch((err) => log.error(err));
try {
// clean, if ready
if ((Date.now() - queue.lastCleanDate.getTime()) >= queue.cfg.concurrency.timeoutMs)
await queue.clean().catch((err) => log.error({ name: queue.type, err }));
// drain
await queue.drain();
}
catch (err) {
log.error({ name: queue.type, err }, "error occurred during queue management");
}
await sleep(EVENT_QUEUE_MANAGE_DELAY_MS);
}
})();