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

This commit is contained in:
gengteng 2024-04-01 10:14:49 +08:00
parent 0de54eb907
commit b83da0f03e

View file

@ -263,7 +263,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();
@ -328,7 +328,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 {