From bdf5a71641d386b67c5827c1aec9f3c19520704c Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Mon, 23 Dec 2024 10:38:07 +0100 Subject: [PATCH] fix(queue): catch exceptions in scheduled runs --- packages/backend/src/modules/queue/queue.entity.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/modules/queue/queue.entity.ts b/packages/backend/src/modules/queue/queue.entity.ts index 549cdab92b..5440bab93f 100644 --- a/packages/backend/src/modules/queue/queue.entity.ts +++ b/packages/backend/src/modules/queue/queue.entity.ts @@ -55,8 +55,12 @@ export class Queue { - this.rpcClient.send(this.queueName, eventData.data); + cron.schedule(cronPattern, async () => { + try { + await this.rpcClient.send(this.queueName, eventData.data); + } catch (e) { + console.error('Error in cron job:', e); + } }); } }