fixed shutdown not working sometimes
This commit is contained in:
parent
18c2720fe8
commit
9065937d2c
1 changed files with 7 additions and 5 deletions
|
|
@ -172,11 +172,13 @@ export class Shutdown {
|
||||||
process.platform === 'win32' ? ['SIGINT', 'SIGTERM'] : ['SIGTERM', 'SIGINT', 'SIGUSR2'];
|
process.platform === 'win32' ? ['SIGINT', 'SIGTERM'] : ['SIGTERM', 'SIGINT', 'SIGUSR2'];
|
||||||
|
|
||||||
signals.forEach(signal => {
|
signals.forEach(signal => {
|
||||||
process.once(signal, () => {
|
process.on(signal, () => {
|
||||||
// Changed from 'on' to 'once' to prevent multiple handlers
|
// Only process if not already shutting down
|
||||||
|
if (!this.isShuttingDown) {
|
||||||
this.shutdownAndExit(signal).catch(() => {
|
this.shutdownAndExit(signal).catch(() => {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue