mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
begin setup flow
This commit is contained in:
committed by
Aiden McClelland
parent
6c68c7fed9
commit
8f362e7d1e
@@ -347,14 +347,14 @@ pub async fn daemon<F: FnMut() -> Fut, Fut: Future<Output = ()> + Send + 'static
|
||||
mut shutdown: tokio::sync::broadcast::Receiver<Option<Shutdown>>,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
loop {
|
||||
match tokio::spawn(f()).await {
|
||||
Err(e) if e.is_panic() => return Err(anyhow!("daemon panicked!")),
|
||||
_ => (),
|
||||
}
|
||||
tokio::select! {
|
||||
_ = shutdown.recv() => return Ok(()),
|
||||
_ = tokio::time::sleep(cooldown) => (),
|
||||
}
|
||||
match tokio::spawn(f()).await {
|
||||
Err(e) if e.is_panic() => return Err(anyhow!("daemon panicked!")),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user