Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to graceful shutdown #202

Open
ipratico opened this issue Nov 28, 2022 · 2 comments
Open

How to graceful shutdown #202

ipratico opened this issue Nov 28, 2022 · 2 comments

Comments

@ipratico
Copy link

Hello,
I'm using a graceful shutdown to close my express server:

process.on('SIGINT', function(){
   server.close(function(err) {
       process.exit(err ? 1 : 0);
   });
}); 

server.close() stops the server from accepting new connections and call the function after all the existing connections are finished. If someone has the page /status open the server won't close because the socket is still open and stays open until the page is closed.

Is there a way to force disconnect all the sockets connected?
I know that socket.io provides this function: io.disconnectSockets(), but how can I access to the "io" instance of express-status-monitor?

@devr77
Copy link

devr77 commented Feb 2, 2023

If You are In Production, I Will recommend use pm2.

@dchitwood3
Copy link

I'm interested in this as well. We run express.js in our Puppeteer testing. Once the test is complete, we need to gracefully exit express.js. However, express-status-monitor is blocking this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants