-
Notifications
You must be signed in to change notification settings - Fork 83
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
Graceful shutdown #226
Comments
Hey, this is a good idea and can certainly be implemented but it will be done in a non breaking way as the current Server.close() method is meant to be synchronous and thus making it asynchronous may break certain applications. |
Hey, which signature do you think would be a better API going forward: // This simply adds the `graceful` argument and changes the return type to now potentially return a Promise
Server.close(graceful: boolean): void | Promise<void>
// This is a different alternative method to `.close()` but maintains a proper return signature and meaningful name
Server.shutdown(): Promise<void> I understand none of the above may be 100% compatible with Express.js but the compatibility gaps are to be reduced in the next major version update. |
That decision would I leave completely up to you, it sound like that its going to change for the next version regardless to bridge the compatible gap |
The |
Trying to figure out how to do a graceful shutdown
The only function i can see it the
.close
described indocs/Server.md
, but that just kills the server and returns a boolThe expected functionality is that it stop accepting connections when
.close
, and then returnes a promise there resolves when there's no more active clients.Any way of doing this would work, thats just express's implementation as far as i know.
The text was updated successfully, but these errors were encountered: