Don't distract startup with background threads

This commit is contained in:
Bojan Serafimov
2023-07-20 22:31:38 -04:00
parent 8d0f4a7857
commit 29bb696f3a

View File

@@ -222,11 +222,6 @@ fn main() -> Result<()> {
compute.state_changed.notify_all();
drop(state);
// Launch remaining service threads
let _monitor_handle = launch_monitor(&compute).expect("cannot launch compute monitor thread");
let _configurator_handle =
launch_configurator(&compute).expect("cannot launch configurator thread");
// Start Postgres
let mut delay_exit = false;
let mut exit_code = None;
@@ -243,6 +238,14 @@ fn main() -> Result<()> {
}
};
// Launch remaining service threads
//
// NOTE we do this after starting postgres so that these two extra threads
// don't blow the cpu budget and throttle the startup process.
let _monitor_handle = launch_monitor(&compute).expect("cannot launch compute monitor thread");
let _configurator_handle =
launch_configurator(&compute).expect("cannot launch configurator thread");
// Wait for the child Postgres process forever. In this state Ctrl+C will
// propagate to Postgres and it will be shut down as well.
if let Some(mut pg) = pg {