fix: start daemon::run_loop from main.rs (Sam & Hermes)
The scheduler tick was wired into daemon::run_loop but main.rs only started the socket server, never the background loop. intake-task commands queued into the scheduler's in-memory queue were never processed. Fix: spawn daemon::run_loop as a second tokio task alongside the socket server.
This commit is contained in:
parent
61b008ac6a
commit
9717ce70f6
1 changed files with 14 additions and 3 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
use std::sync::Arc;
|
||||
|
||||
use colibri_daemon::{session, socket, DaemonConfig, DaemonState, SharedState};
|
||||
use colibri_daemon::{daemon, session, socket, DaemonConfig, DaemonState, SharedState};
|
||||
use tracing::info;
|
||||
|
||||
#[tokio::main]
|
||||
|
|
@ -75,6 +75,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
socket::serve(socket_state, socket_shutdown).await;
|
||||
});
|
||||
|
||||
// Start the daemon background loop (heartbeat, session rotation, scheduler)
|
||||
let loop_state = state.clone();
|
||||
let loop_shutdown = state.shutdown_rx.resubscribe();
|
||||
let loop_config = daemon::DaemonLoopConfig::default();
|
||||
let loop_handle = tokio::spawn(async move {
|
||||
daemon::run_loop(loop_state, loop_config, loop_shutdown).await;
|
||||
});
|
||||
|
||||
// Listen for shutdown signals
|
||||
let shutdown_state = state.clone();
|
||||
tokio::spawn(async move {
|
||||
|
|
@ -93,8 +101,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
});
|
||||
|
||||
// Wait for the socket server to finish
|
||||
socket_handle.await?;
|
||||
// Wait for the socket server and daemon loop to finish
|
||||
tokio::select! {
|
||||
_ = socket_handle => {},
|
||||
_ = loop_handle => {},
|
||||
}
|
||||
|
||||
info!("colibri-daemon shut down cleanly");
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue