mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-10 01:06:17 +00:00
fix: prevent process.exit() from killing internal scheduler
This commit is contained in:
@@ -719,7 +719,10 @@ export class MicrosoftRewardsBot {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
process.exit()
|
// Don't exit here - let the caller decide (enables scheduler mode)
|
||||||
|
// For one-time runs, the caller (bootstrap) will exit after run() returns
|
||||||
|
// For scheduled mode, the scheduler keeps the process alive
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1214,6 +1217,10 @@ async function main(): Promise<void> {
|
|||||||
// One-time execution (scheduling disabled)
|
// One-time execution (scheduling disabled)
|
||||||
await rewardsBot.initialize()
|
await rewardsBot.initialize()
|
||||||
await rewardsBot.run()
|
await rewardsBot.run()
|
||||||
|
|
||||||
|
// Explicit exit for one-time runs (no scheduler to keep alive)
|
||||||
|
log('main', 'MAIN', 'One-time run completed. Exiting.', 'log', 'green')
|
||||||
|
gracefulExit(0)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('main', 'MAIN-ERROR', 'Fatal during run: ' + (e instanceof Error ? e.message : e), 'error')
|
log('main', 'MAIN-ERROR', 'Fatal during run: ' + (e instanceof Error ? e.message : e), 'error')
|
||||||
gracefulExit(1)
|
gracefulExit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user