-
Notifications
You must be signed in to change notification settings - Fork 34
Feature: Add graceful shutdown handling to API server #76
Copy link
Copy link
Open
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programapiREST API componentREST API componenteasyDifficulty: EasyDifficulty: EasyenhancementNew feature or requestNew feature or request
Description
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
- SIGTERM triggers graceful shutdown
- In-flight requests complete before close
- Force exit after timeout (10s)
- Shutdown logged
Technical Notes
- File:
api/src/index.ts
Constraints
- Must work with Vercel serverless (may not apply there)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programapiREST API componentREST API componenteasyDifficulty: EasyDifficulty: EasyenhancementNew feature or requestNew feature or request