stop tasks with missmatch cronId

This commit is contained in:
Andres Pache
2025-09-03 18:35:30 -03:00
parent 43cc6d3608
commit 613d486fc2

View File

@@ -4367,7 +4367,11 @@ export class BaileysStartupService extends ChannelStartupService {
const cache = this.chatwootService.getCache(); const cache = this.chatwootService.getCache();
if (cache) { if (cache) {
const storedId = await cache.hGet(cronKey, this.instance.name); 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); this.chatwootService.syncLostMessages({ instanceName: this.instance.name }, chatwootConfig, prepare);
}); });