Continuing refactor

This commit is contained in:
Igor Katson 2023-11-25 00:24:32 +00:00
parent 73e41ba7d5
commit 17b243921d
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
11 changed files with 395 additions and 64 deletions

View file

@ -1,6 +1,7 @@
use tracing::{debug, trace, Instrument};
use tracing::{debug, trace, warn, Instrument};
pub fn spawn(
name: &str,
span: tracing::Span,
fut: impl std::future::Future<Output = anyhow::Result<()>> + Send + 'static,
) -> tokio::task::JoinHandle<()> {
@ -11,12 +12,12 @@ pub fn spawn(
debug!("finished");
}
Err(e) => {
debug!("finished with error: {:#}", e)
warn!("finished with error: {:#}", e)
}
}
}
.instrument(span.or_current());
tokio::spawn(fut)
tokio::task::Builder::new().name(name).spawn(fut).unwrap()
}
#[derive(Clone, Copy, Debug)]