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

Question: does this kill the open connections? #2

Open
japrescott opened this issue Apr 24, 2014 · 2 comments
Open

Question: does this kill the open connections? #2

japrescott opened this issue Apr 24, 2014 · 2 comments

Comments

@japrescott
Copy link

I like to use this module but was wondering if this shutsdown and kills the open connections or if it indicates if there are still open connections waiting for answers (say from the database). That would let me write a script that would check if the app is fully in maintenance mode before I kill the database or such.

@alexbeletsky
Copy link
Member

No, it doesn't do that for now.. it's a great question, it would be great if maintenance can do that.

Do you have any ideas how to accomplish that?

@japrescott
Copy link
Author

hey alexander, thanks for answering. it certainly would be great if maintenance could do that!
One method I could imagine would be to wrap res.send etc. (or maybe only res.end, since that should be called everytime at the end) and apply a counter for incoming/finished requests. If maintenance goes on, it stops accepting connections (telling the load-balancer to back off -> or just redirects all traffic to the maintenance page) starts a timer and waits till timer executes or incoming/finished hits 0. It then sends off a curl to a rest interface or sets a redis variable that its now in maintenance. If all nodes are in maintenance, it kicks off a further rest-interface/sets a redis variable/publishes and we can start our database etc. update.

or as an alternative would be to let one get the maintenance status of a node via rest. then one would implement the logic of the "am i in maintenance"-mode in the upgrade-script.

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

2 participants