fixed some issues, testing shutdown
This commit is contained in:
parent
dbfa80b2a2
commit
0497541a47
11 changed files with 15 additions and 800 deletions
|
|
@ -174,6 +174,9 @@ export class EnvLoader implements ConfigLoader {
|
|||
'NAME': ['name'],
|
||||
'VERSION': ['version'],
|
||||
|
||||
// Logging mappings
|
||||
'LOG_LEVEL': ['logging', 'level'],
|
||||
|
||||
// Special mappings to avoid conflicts
|
||||
'DEBUG_MODE': ['debug'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ function createTransports(serviceName: string, config: LoggerConfig = globalConf
|
|||
ignore: 'pid,hostname,service,environment,version,childName',
|
||||
errorLikeObjectKeys: ['err', 'error'],
|
||||
errorProps: 'message,stack,name,code',
|
||||
sync: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,11 @@ export class Queue {
|
|||
|
||||
// Close workers first
|
||||
if (this.workers.length > 0) {
|
||||
await Promise.all(this.workers.map(worker => worker.close()));
|
||||
await Promise.all(
|
||||
this.workers.map(async worker => {
|
||||
return await worker.close();
|
||||
})
|
||||
);
|
||||
this.workers = [];
|
||||
logger.debug('Workers closed', { queueName: this.queueName });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ export class Shutdown {
|
|||
}
|
||||
|
||||
// Don't call process.exit here - let the caller decide
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +172,8 @@ 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.once(signal, () => {
|
||||
// Changed from 'on' to 'once' to prevent multiple handlers
|
||||
this.shutdownAndExit(signal).catch(() => {
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue