Skip to content

Commit

Permalink
avoid inheriting span into effect
Browse files Browse the repository at this point in the history
That only causes incomplete spans in the tracing when the Span is cached.
  • Loading branch information
sokra committed Jan 22, 2025
1 parent d12e2e8 commit a21022b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions turbopack/crates/turbo-tasks/src/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type EffectFuture = Pin<Box<dyn Future<Output = Result<()>> + Send + Sync + 'sta
/// The inner state of an effect instance if it has not been applied yet.
struct EffectInner {
future: EffectFuture,
span: Span,
}

enum EffectState {
Expand All @@ -51,7 +50,6 @@ impl EffectInstance {
Self {
inner: Mutex::new(EffectState::NotStarted(EffectInner {
future: Box::pin(future),
span: Span::current(),
})),
}
}
Expand Down Expand Up @@ -87,10 +85,10 @@ impl EffectInstance {
State::Started(listener) => {
listener.await;
}
State::NotStarted(EffectInner { future, span }) => {
State::NotStarted(EffectInner { future }) => {
let join_handle = tokio::spawn(
turbo_tasks_future_scope(turbo_tasks::turbo_tasks(), future)
.instrument(span),
.instrument(Span::current()),
);
let result = match join_handle.await {
Ok(Err(err)) => Err(SharedError::new(err)),
Expand Down

0 comments on commit a21022b

Please sign in to comment.