Skip to content

Commit 7a8f872

Browse files
committed
Cleanup gracefulShutdown handover to forcefulShutdown
1 parent 128f52e commit 7a8f872

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,13 +839,15 @@ export function _runTaskList(
839839
cancelledJobs,
840840
});
841841
}
842+
842843
if (this._forcefulShuttingDown) {
843844
errors.push(
844845
new Error(
845846
"forcefulShutdown was initiated whilst gracefulShutdown was still executing.",
846847
),
847848
);
848849
}
850+
849851
if (errors.length === 1) {
850852
throw errors[0];
851853
} else if (errors.length > 1) {
@@ -872,8 +874,13 @@ export function _runTaskList(
872874
error: e,
873875
},
874876
);
875-
// Note: we now rely on forcefulShutdown to handle terminate()
876-
return this.forcefulShutdown(message);
877+
// NOTE: we now rely on forcefulShutdown to handle terminate()
878+
if (this._forcefulShuttingDown) {
879+
// Skip the warning about double shutdown
880+
return forcefulShutdownPromise;
881+
} else {
882+
return this.forcefulShutdown(message);
883+
}
877884
}
878885
if (!terminated) {
879886
await terminate();

0 commit comments

Comments
 (0)