Performance: Graceful shutdown handling
HIGH IMPACT
This affects server responsiveness and resource cleanup during shutdown, impacting user experience and server restart speed.
process.on('SIGINT', () => { server.close(() => { // cleanup resources here process.exit(0); }); });
process.on('SIGINT', () => { server.close(); process.exit(0); });
| Pattern | Active Requests Handling | Resource Cleanup | Shutdown Delay | Verdict |
|---|---|---|---|---|
| Immediate exit after close() | Drops active requests | No cleanup | Minimal but unsafe | [X] Bad |
| Wait for close callback before exit | Waits for active requests | Allows cleanup | Slight delay but safe | [OK] Good |