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'];
|
||||
|
||||
signals.forEach(signal => {
|
||||
process.once(signal, () => {
|
||||
// Changed from 'on' to 'once' to prevent multiple handlers
|
||||
process.on(signal, () => {
|
||||
// Only process if not already shutting down
|
||||
if (!this.isShuttingDown) {
|
||||
this.shutdownAndExit(signal).catch(() => {
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue