-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add non-exiting methods and implement SIGHUP reload #405
base: main
Are you sure you want to change the base?
Conversation
I think it is nice to break down the functions so that it is more flexible. On the other hand, the reload in the example has a downtime (the old service shuts down before the new service starts). Do you have a plan to address that? To me, the way of graceful reload is the following
The current |
I agree that the new service should be started before shutting down the old one, and I thought I had attempted to do this in the example. After conducting some simple tests, it seemed to work as expected. However, more thorough testing might be necessary to ensure everything is functioning correctly. I'll conduct some additional tests to verify this. |
After trying, I found that in the example, the actual behavior is:
These two steps can be considered to occur simultaneously. If the old service doesn't start to gracefully exit, the call to bootstrap() during the upgrade will fail, preventing the new service from actually starting. From analysis and logs, it appears that in non-high concurrency situations, from the time the old service begins to gracefully exit until the new service successfully starts, requests can continue to work without downtime. Logs:
|
6650a32
to
54cb6e0
Compare
54cb6e0
to
951fbfc
Compare
951fbfc
to
b9a6827
Compare
Hey team! I've tried to make a few small tweaks to our server to hopefully improve its flexibility and add some reload functionality. Here's what's new:
pub fn try_bootstrap(&mut self) -> Result<bool>
that doesn't call exitpub fn bootstrap(&mut self)
to use the newtry_bootstrap
methodpub fn run_server(mut self, enable_daemon: bool) -> Result<bool>
that doesn't call exitpub fn run_forever(mut self) -> !
the same, but now it callsrun_server
under the hoodSIGHUP
catching for reloadingRelated issues: