Skip to content

Commit

Permalink
fix: propagate span into cache writing task
Browse files Browse the repository at this point in the history
  • Loading branch information
talzion12 committed Apr 25, 2023
1 parent d2352f1 commit e0c77ba
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/cache/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use hyper::{
Body,
};
use phf::phf_set;
use tracing::Instrument;
use url::Url;

use crate::cache::metadata::CacheMetadata;
Expand Down Expand Up @@ -135,12 +136,15 @@ where
let (sender, receiver) = channel::<Bytes>(10);
let cache_cloned = self.cache.clone();

tokio::spawn(async move {
match cache_cloned.set(&uri, receiver, metadata).await {
Ok(()) => tracing::info!("Wrote to cache"),
Err(err) => tracing::error!("Failed to write to cache {err:?}"),
tokio::spawn(
async move {
match cache_cloned.set(&uri, receiver, metadata).await {
Ok(()) => tracing::info!("Wrote to cache"),
Err(err) => tracing::error!("Failed to write to cache {err:?}"),
}
}
});
.in_current_span(),
);

let res_body = Body::wrap_stream(body.then(move |part| {
tracing::debug!("Received part");
Expand Down

0 comments on commit e0c77ba

Please sign in to comment.