Skip to content

Commit

Permalink
Merge pull request #3290 from autonomys/improve-cache-groups-logging
Browse files Browse the repository at this point in the history
Improve logging with multiple cache groups
  • Loading branch information
nazar-pc authored Dec 7, 2024
2 parents 7a8cad0 + 6443b05 commit 07a3f4e
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use subspace_farmer::single_disk_farm::identity::Identity;
use subspace_farmer::utils::{run_future_in_dedicated_thread, AsyncJoinOnDrop};
use subspace_kzg::Kzg;
use subspace_networking::utils::piece_provider::PieceProvider;
use tracing::info;
use tracing::{info, info_span, Instrument};

/// Get piece retry attempts number.
const PIECE_GETTER_MAX_RETRIES: u16 = 7;
Expand Down Expand Up @@ -174,8 +174,9 @@ pub(super) async fn controller(

let farmer_cache_workers_fut = farmer_cache_workers
.into_iter()
.zip(&cache_groups)
.enumerate()
.map(|(index, farmer_cache_worker)| {
.map(|(index, (farmer_cache_worker, cache_group))| {
// Each farmer cache worker gets a customized piece getter that can leverage other
// caches than itself for sync purposes
let piece_getter = FarmerPieceGetter::new(
Expand All @@ -184,7 +185,7 @@ pub(super) async fn controller(
farmer_caches
.iter()
.enumerate()
.filter(|&(filter_index, _farmer_cache)| (filter_index != index))
.filter(|&(filter_index, _farmer_cache)| filter_index != index)
.map(|(_filter_index, farmer_cache)| farmer_cache.clone())
.collect::<Box<_>>(),
)),
Expand All @@ -203,7 +204,9 @@ pub(super) async fn controller(
},
);

let fut = farmer_cache_worker.run(piece_getter.downgrade());
let fut = farmer_cache_worker
.run(piece_getter.downgrade())
.instrument(info_span!("", %cache_group));

async move {
let fut =
Expand Down

0 comments on commit 07a3f4e

Please sign in to comment.