-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactor Server customize shutdown and signals to support embedding #493
base: main
Are you sure you want to change the base?
Conversation
0ae925f
to
6773af5
Compare
…ior. This change supports building a server that can run Pingora without it calling std::process::exit during shutdown.
6773af5
to
11881c5
Compare
GracefulTerminate, | ||
FastShutdown, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add doc comments for these public types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added doc comments
pingora-core/src/server/mod.rs
Outdated
@@ -306,14 +362,25 @@ impl Server { | |||
} | |||
} | |||
|
|||
/// Start the server using [Self::run] and default [RunArgs]. | |||
#[allow(unused_mut)] // TODO: May not need to keep mut self in interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the mut
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed mut
FastShutdown, | ||
} | ||
|
||
#[async_trait] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, do you mind adding doc comments for these public types as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, added some docs. Let me know if you would like them worded differently.
/// Shutdown with no timeout for runtime shutdown. | ||
FastShutdown, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense to derive Debug
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added Debug
derive. Not sure if you also want me to go ahead and add to other related ones like ShutdownType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I'm not affiliated with Cloudflare, I just started using your changes from here and ran into an issue due to the missing Debug impl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the issue you encountered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if there are any other changes, e.g., the Debug
derive that someone else had requested. Should that still stay in?
This change currently aims to minimize the code diff. Still need to test for my use case.
Fixes #492