Compare commits

...

1 Commits
v0.2.5 ... main

Author SHA1 Message Date
562c10329e Handle SIGTERM and SIGINT signal (#3)
All checks were successful
Publish mock-lockdrop-watcher docker image on release / Run docker build and publish (release) Successful in 59s
Part of https://plan.wireit.in/deepstack/browse/VUL-294/

Co-authored-by: Pranav <jadhavpranav89@gmail.com>
Reviewed-on: #3
2025-12-09 05:33:32 +00:00
2 changed files with 18 additions and 2 deletions

View File

@ -19,9 +19,25 @@ async function startServer() {
const PORT = process.env.PORT || 6000;
app.listen(PORT, () => {
const httpServer = app.listen(PORT, () => {
console.log(`🚀 Server ready at http://localhost:${PORT}${server.graphqlPath}`);
});
const shutdown = async (signal: string) => {
console.log(`${signal} received, shutting down gracefully...`);
httpServer.close(() => {
console.log('HTTP server closed');
});
await server.stop();
console.log('Apollo server stopped');
process.exit(0);
};
process.on('SIGTERM', () => shutdown('SIGTERM'));
process.on('SIGINT', () => shutdown('SIGINT'));
}
startServer().catch(error => {

View File

@ -7,7 +7,7 @@ services:
VERIFIED_PARTICIPANTS_PATH: /tmp/watcher-data/verified-participants.json
GENERATED_WATCHER_EVENTS_OUTPUT_PATH: /tmp/watcher-data/generated
working_dir: /app/
command: "node --enable-source-maps dist/index.js"
command: ["node", "--enable-source-maps", "dist/index.js"]
volumes:
- watcher-data:/tmp/watcher-data
ports: