From 4ac97138f542d92ab65665b25701cc5687fdd596 Mon Sep 17 00:00:00 2001 From: tedious Date: Fri, 26 Jul 2024 20:45:11 +0800 Subject: [PATCH] chore: log the number of caches and farms --- crates/subspace-farmer/src/cluster/cache.rs | 5 +++-- crates/subspace-farmer/src/cluster/farmer.rs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/subspace-farmer/src/cluster/cache.rs b/crates/subspace-farmer/src/cluster/cache.rs index cd297ddeb4..84f2157ab8 100644 --- a/crates/subspace-farmer/src/cluster/cache.rs +++ b/crates/subspace-farmer/src/cluster/cache.rs @@ -332,7 +332,8 @@ async fn send_identify_broadcast( ) where C: PieceCache, { - let Some(cache_id) = caches_details.first().map(|cache| cache.cache_id) else { + let cache_count = caches_details.len(); + if cache_count == 0 { // No caches, nothing to do return; }; @@ -348,7 +349,7 @@ async fn send_identify_broadcast( .broadcast(&ClusterCacheIdentifyBroadcast { details }, cache_group) .await { - warn!(%cache_id, %error, "Failed to send cache identify notification"); + warn!(%cache_count, %error, "Failed to send cache identify notification"); }; } diff --git a/crates/subspace-farmer/src/cluster/farmer.rs b/crates/subspace-farmer/src/cluster/farmer.rs index 6af763f31b..f6d2eadd71 100644 --- a/crates/subspace-farmer/src/cluster/farmer.rs +++ b/crates/subspace-farmer/src/cluster/farmer.rs @@ -594,7 +594,8 @@ async fn send_identify_broadcast(nats_client: &NatsClient, farms_details: &[Farm ) .await { - warn!(%farm_id_string, %error, "Failed to send farmer identify notification"); + let farm_count = farms_details.len(); + warn!(%farm_id_string, %farm_count, %error, "Failed to send farmer identify notification"); } }