feat: Change Server::run_forever to take ownership and ensure exit semantics

Includes-commit: b83da0f03e
Replicated-from: https://github.com/cloudflare/pingora/pull/176
This commit is contained in:
gengteng 2024-04-01 02:14:49 +00:00 committed by Yuchen Wu
parent 7ea2ac970a
commit 5ea8c46696
2 changed files with 3 additions and 3 deletions

2
.bleep
View file

@ -1 +1 @@
c413c5d1a2594cafa6d6c61829ffe3350afd677c
f54615d5e74b9ab529695a1400250b54d47a4dd5

View file

@ -289,7 +289,7 @@ impl Server {
///
/// Note: this function may fork the process for daemonization, so any additional threads created
/// before this function will be lost to any service logic once this function is called.
pub fn run_forever(&mut self) {
pub fn run_forever(mut self) -> ! {
info!("Server starting");
let conf = self.configuration.as_ref();
@ -364,7 +364,7 @@ impl Server {
}
}
info!("All runtimes exited, exiting now");
std::process::exit(0);
std::process::exit(0)
}
fn create_runtime(name: &str, threads: usize, work_steal: bool) -> Runtime {