This commit is contained in:
Igor Katson 2023-11-24 18:28:46 +00:00
parent 0b8580dacd
commit d7a37c1b48
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
11 changed files with 337 additions and 168 deletions

View file

@ -1,9 +1,9 @@
use tracing::{debug, error, trace, Instrument};
use tracing::{debug, trace, Instrument};
pub fn spawn(
span: tracing::Span,
fut: impl std::future::Future<Output = anyhow::Result<()>> + Send + 'static,
) {
) -> tokio::task::JoinHandle<()> {
let fut = async move {
trace!("started");
match fut.await {
@ -11,12 +11,12 @@ pub fn spawn(
debug!("finished");
}
Err(e) => {
error!("{:#}", e)
debug!("finished with error: {:#}", e)
}
}
}
.instrument(span.or_current());
tokio::spawn(fut);
tokio::spawn(fut)
}
#[derive(Clone, Copy, Debug)]