mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 11:42:24 +08:00
feat(api): graceful shutdown for less 502 errors
This commit is contained in:
parent
c327d688a6
commit
740a429790
|
@ -80,6 +80,17 @@ function startServer(port = DEFAULT_PORT) {
|
|||
`For the Queue UI, open: http://${HOST}:${port}/admin/${process.env.BULL_AUTH_KEY}/queues`
|
||||
);
|
||||
});
|
||||
|
||||
const exitHandler = () => {
|
||||
logger.info('SIGTERM signal received: closing HTTP server')
|
||||
server.close(() => {
|
||||
logger.info("Server closed.");
|
||||
process.exit(0);
|
||||
});
|
||||
};
|
||||
|
||||
process.on('SIGTERM', exitHandler);
|
||||
process.on('SIGINT', exitHandler);
|
||||
return server;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user