Skip to content

Commit

Permalink
fix(bot): set processing to false after cleaning orphaned bots
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Jul 30, 2024
1 parent c4ee4b2 commit 4b11d6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/bot/src/processing/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}]`);
Expand All @@ -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) {
Expand Down

0 comments on commit 4b11d6c

Please sign in to comment.