Skip to content

Commit 3f2865a

Browse files
committed
PEER-220: Try fix process shutdown
Signed-off-by: SeeuSim <[email protected]>
1 parent 73b4485 commit 3f2865a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backend/matching/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ server.listen(port, () => {
1515
['Cleaner', 'Matcher'].map(initWorker).forEach((process) => workers.push(process));
1616
});
1717

18-
const shutdown = async () => {
19-
await Promise.all(workers.map((worker) => worker.kill()));
18+
const shutdown = () => {
19+
workers.forEach((worker) => {
20+
worker.kill();
21+
});
2022
server.close(() => {
2123
logger.info('App shut down');
2224
});
2325
};
2426

2527
process.on('SIGINT', shutdown);
2628
process.on('SIGTERM', shutdown);
29+
process.on('exit', shutdown);

0 commit comments

Comments
 (0)