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

Refactor Server customize shutdown and signals to support embedding #493

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kriswuollett
Copy link

@kriswuollett kriswuollett commented Dec 13, 2024

This change currently aims to minimize the code diff. Still need to test for my use case.

Fixes #492

@kriswuollett kriswuollett marked this pull request as draft December 13, 2024 17:07
@kriswuollett kriswuollett force-pushed the signal-handling-fn branch 2 times, most recently from 0ae925f to 6773af5 Compare December 13, 2024 17:34
…ior.

This change supports building a server that can run Pingora without it
calling std::process::exit during shutdown.
@kriswuollett kriswuollett marked this pull request as ready for review December 13, 2024 18:01
@drcaramelsyrup drcaramelsyrup self-requested a review December 20, 2024 17:26
GracefulTerminate,
FastShutdown,
}

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added doc comments

@@ -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
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed mut

@andrewhavck andrewhavck self-assigned this Dec 24, 2024
FastShutdown,
}

#[async_trait]
Copy link
Contributor

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?

Copy link
Author

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,
}

Copy link

@theduke theduke Jan 11, 2025

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.

Copy link
Author

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?

Copy link

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.

Copy link
Author

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?

Copy link
Author

@kriswuollett kriswuollett left a 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?

@gumpt gumpt added Accepted This change is accepted by us and merged to our internal repo WIP We are working on this feature internally labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted This change is accepted by us and merged to our internal repo WIP We are working on this feature internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support running Server without std::process::exit
4 participants