Add #[track_caller] to all spawns so that tokio-console works (if enabled)
This commit is contained in:
parent
edba359400
commit
d6b1c47d45
4 changed files with 5 additions and 0 deletions
|
|
@ -816,6 +816,7 @@ impl Session {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Spawn a task in the context of the session.
|
/// Spawn a task in the context of the session.
|
||||||
|
#[track_caller]
|
||||||
pub fn spawn(
|
pub fn spawn(
|
||||||
&self,
|
&self,
|
||||||
span: tracing::Span,
|
span: tracing::Span,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/// Spawn a future inside a tracing span, while logging it's start,
|
/// Spawn a future inside a tracing span, while logging it's start,
|
||||||
/// finish and periodically logging if it's still alive.
|
/// finish and periodically logging if it's still alive.
|
||||||
|
#[track_caller]
|
||||||
pub fn spawn(
|
pub fn spawn(
|
||||||
_name: &str,
|
_name: &str,
|
||||||
span: tracing::Span,
|
span: tracing::Span,
|
||||||
|
|
|
||||||
|
|
@ -310,6 +310,7 @@ impl TorrentStateLive {
|
||||||
Ok(state)
|
Ok(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
pub(crate) fn spawn(
|
pub(crate) fn spawn(
|
||||||
&self,
|
&self,
|
||||||
span: tracing::Span,
|
span: tracing::Span,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ impl std::fmt::Display for CancelledError {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Spawns a future with tracing instrumentation.
|
/// Spawns a future with tracing instrumentation.
|
||||||
|
#[track_caller]
|
||||||
pub fn spawn(
|
pub fn spawn(
|
||||||
span: tracing::Span,
|
span: tracing::Span,
|
||||||
fut: impl std::future::Future<Output = anyhow::Result<()>> + Send + 'static,
|
fut: impl std::future::Future<Output = anyhow::Result<()>> + Send + 'static,
|
||||||
|
|
@ -49,6 +50,7 @@ pub fn spawn(
|
||||||
tokio::task::spawn(fut)
|
tokio::task::spawn(fut)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
pub fn spawn_with_cancel(
|
pub fn spawn_with_cancel(
|
||||||
span: tracing::Span,
|
span: tracing::Span,
|
||||||
cancellation_token: CancellationToken,
|
cancellation_token: CancellationToken,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue