From 4b11d6c76c367c37f17a49a55dfbd5f4b1c10dfd Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 30 Jul 2024 02:08:05 +0100 Subject: [PATCH] fix(bot): set `processing` to `false` after cleaning orphaned bots --- packages/bot/src/processing/processor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bot/src/processing/processor.ts b/packages/bot/src/processing/processor.ts index ac5f7d1c..fab2280f 100644 --- a/packages/bot/src/processing/processor.ts +++ b/packages/bot/src/processing/processor.ts @@ -56,7 +56,7 @@ export class Processor { */ async stopEnabledBots() { const bots = await xprisma.bot.custom.findMany({ - where: { enabled: true }, + where: { OR: [{ enabled: true }, { processing: true }] }, include: { exchangeAccount: true }, }); if (bots.length === 0) return; @@ -68,7 +68,7 @@ export class Processor { await xprisma.bot.custom.update({ where: { id: bot.id }, - data: { enabled: false }, + data: { enabled: false, processing: false }, }); logger.info(`[Processor] Bot stopped [id=${bot.id} name=${bot.name}]`); @@ -82,7 +82,7 @@ export class Processor { */ async cleanOrphanedBots() { const anyBotEnabled = await xprisma.bot.custom.findFirst({ - where: { enabled: true }, + where: { OR: [{ enabled: true }, { processing: true }] }, }); if (anyBotEnabled) {