diff --git a/crates/crates_io_worker/src/worker.rs b/crates/crates_io_worker/src/worker.rs index 149bc52ac5e..1e233ae8acd 100644 --- a/crates/crates_io_worker/src/worker.rs +++ b/crates/crates_io_worker/src/worker.rs @@ -12,7 +12,7 @@ use std::panic::AssertUnwindSafe; use std::sync::Arc; use std::time::Duration; use tokio::time::sleep; -use tracing::{debug, error, info_span, warn}; +use tracing::{Instrument, debug, error, info_span, warn}; pub struct Worker { pub(crate) connection_pool: Pool, @@ -70,7 +70,6 @@ impl Worker { }; let span = info_span!("job", job.id = %job.id, job.typ = %job.job_type); - let _enter = span.enter(); let job_id = job.id; debug!("Running job…"); @@ -88,9 +87,15 @@ impl Worker { .and_then(std::convert::identity) }); - match future.bind_hub(Hub::current()).await { + let result = future + .instrument(span.clone()) + .bind_hub(Hub::current()) + .await; + + let _enter = span.enter(); + match result { Ok(_) => { - debug!("Deleting successful job…"); + warn!("Deleting successful job…"); storage::delete_successful_job(conn, job_id).await? } Err(error) => {