Problem
The API server in api/src/index.ts doesn't handle graceful shutdown. On SIGTERM/SIGINT, in-flight requests are dropped.
Context
During deployments, requests in progress should complete before the server stops.
Proposed Solution
const server = app.listen(port);
process.on('SIGTERM', () => {
logger.info('SIGTERM received, shutting down gracefully');
server.close(() => {
logger.info('Server closed');
process.exit(0);
});
setTimeout(() => process.exit(1), 10000); // force after 10s
});
Acceptance Criteria
Technical Notes
Constraints
- Must work with Vercel serverless (may not apply there)
Problem
The API server in
api/src/index.tsdoesn't handle graceful shutdown. On SIGTERM/SIGINT, in-flight requests are dropped.Context
During deployments, requests in progress should complete before the server stops.
Proposed Solution
Acceptance Criteria
Technical Notes
api/src/index.tsConstraints