Skip to content

Commit 9676a9e

Browse files
committed
fixes
1 parent b37de33 commit 9676a9e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

js/botasaurus-server-js/src/worker-executor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,9 @@ export class WorkerExecutor extends TaskExecutor {
508508
private setupGracefulShutdown(): void {
509509
const shutdownHandler = async (signal: string) => {
510510
if (this.isShuttingDown) return;
511+
this.isShuttingDown = true;
511512

512513
console.log(`[Worker] Received ${signal}, initiating graceful shutdown...`);
513-
this.isShuttingDown = true;
514514

515515
// Immediately notify master about in-progress tasks
516516
if (this.inProgressTaskIds.size > 0) {
@@ -520,6 +520,8 @@ export class WorkerExecutor extends TaskExecutor {
520520
} catch (error) {
521521
console.warn('[Worker] Failed to notify master of shutdown, tasks will recover via visibility timeout:', error);
522522
}
523+
} else {
524+
console.log('[Worker] No in-progress tasks to release');
523525
}
524526
};
525527

0 commit comments

Comments
 (0)