Skip to content

Commit

Permalink
fix(platform): doesn't cancel orders on clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Dec 22, 2024
1 parent 8f5e0f0 commit 717ed57
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/bot/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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}]`);
}
}
Expand Down

0 comments on commit 717ed57

Please sign in to comment.