From 613d486fc243e323cc89c4f8ce903e5544a90de2 Mon Sep 17 00:00:00 2001 From: Andres Pache Date: Wed, 3 Sep 2025 18:35:30 -0300 Subject: [PATCH] stop tasks with missmatch cronId --- .../channel/whatsapp/whatsapp.baileys.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 32ae48fa..5b0d5750 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -4367,7 +4367,11 @@ export class BaileysStartupService extends ChannelStartupService { const cache = this.chatwootService.getCache(); if (cache) { const storedId = await cache.hGet(cronKey, this.instance.name); - if (storedId && storedId !== cronId) return; + if (storedId && storedId !== cronId) { + this.logger.info(`Stopping syncChatwootLostMessages cron - ID mismatch: ${cronId} vs ${storedId}`); + task.stop(); + return; + } } this.chatwootService.syncLostMessages({ instanceName: this.instance.name }, chatwootConfig, prepare); });