fix(connection): improve connection handling and timeouts
This commit is contained in:
@@ -354,17 +354,17 @@ export class LogDeduplicator {
|
||||
// Global instance for connection-related log deduplication
|
||||
export const connectionLogDeduplicator = new LogDeduplicator(5000); // 5 second batches
|
||||
|
||||
// Ensure logs are flushed on process exit
|
||||
// Ensure logs are flushed on process exit.
|
||||
// Only use beforeExit — do NOT call process.exit() from SIGINT/SIGTERM handlers
|
||||
// as that kills the host process's graceful shutdown (e.g., dcrouter connection draining).
|
||||
process.on('beforeExit', () => {
|
||||
connectionLogDeduplicator.flushAll();
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
connectionLogDeduplicator.cleanup();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
process.on('SIGTERM', () => {
|
||||
connectionLogDeduplicator.cleanup();
|
||||
process.exit(0);
|
||||
});
|
||||
Reference in New Issue
Block a user