diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index cf54bab..0da9d9f 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -861,7 +861,9 @@ pub fn main(timer: GlobalTimer, cfg: Config) { // keep yielding }) => (), _ = terminate.async_wait().fuse() => (), - _ = restart_idle.async_wait().fuse() => () + _ = async { + restart_idle.async_wait().fuse(), + } } connection.signal(); }); @@ -926,8 +928,10 @@ pub fn main(timer: GlobalTimer, cfg: Config) { load_and_run_idle_kernel(&buffer, &control, &up_destinations, &aux_mutex, &routing_table, timer).await; } }).fuse() => (), - _ = terminate.async_wait().fuse() => (), - _ = restart_idle.async_wait().fuse() => () + _ = (async { + restart_idle.0.async_wait().await; + restart_idle.1.signal(); + }).fuse() => (), } drop(_lock); } diff --git a/src/runtime/src/mgmt.rs b/src/runtime/src/mgmt.rs index ea79327..1eebd1e 100644 --- a/src/runtime/src/mgmt.rs +++ b/src/runtime/src/mgmt.rs @@ -201,10 +201,11 @@ async fn handle_connection(stream: &mut TcpStream, pull_id: Rc>, cf let value = cfg.write(&key, buffer); if value.is_ok() { debug!("write success"); - write_i8(stream, Reply::Success as i8).await?; if key == "idle_kernel" { - restart_idle.signal(); + restart_idle.1.async_wait().await?; + restart_idle.0.signal(); } + write_i8(stream, Reply::Success as i8).await?; } else { // this is an error because we do not expect write to fail error!("failed to write: {:?}", value);