diff --git a/packages/bot/src/platform.ts b/packages/bot/src/platform.ts index c249d3bb..1b776044 100644 --- a/packages/bot/src/platform.ts +++ b/packages/bot/src/platform.ts @@ -58,7 +58,7 @@ export class Platform { if (bots.length === 0) return; logger.info(`[Processor] Stopping ${bots.length} bots gracefully…`); - for (const bot of bots) { + for (let bot of bots) { // Check if the strategy function exists // If not, just mark the bot as disabled try { @@ -78,14 +78,15 @@ export class Platform { continue; } - const botProcessor = new BotProcessing(bot); - await botProcessor.processStopCommand(); - - await xprisma.bot.custom.update({ + bot = await xprisma.bot.custom.update({ where: { id: bot.id }, data: { enabled: false, processing: false }, + include: { exchangeAccount: true }, }); + const botProcessor = new BotProcessing(bot); + await botProcessor.processStopCommand(); + logger.info(`[Processor] Bot stopped [id=${bot.id} name=${bot.name}]`); } }