node: Move seeds log to better place

Instead of logging connected/disconnected seeds every time the seeds function
is called, we only log it when a user calls the function.
This commit is contained in:
Alexis Sellier 2023-05-11 10:36:30 +02:00
parent a5d85a0d24
commit d758c4f203
No known key found for this signature in database
1 changed files with 6 additions and 8 deletions

View File

@ -474,6 +474,11 @@ where
}
Command::Seeds(rid, resp) => match self.seeds(&rid) {
Ok(seeds) => {
debug!(
target: "service",
"Found {} connected seed(s) and {} disconnected seed(s) for {}",
seeds.connected().count(), seeds.disconnected().count(), rid
);
resp.send(seeds).ok();
}
Err(e) => {
@ -1303,7 +1308,7 @@ where
disconnected: usize,
}
let (stats, seeds) = match self.routing.get(rid) {
let (_, seeds) = match self.routing.get(rid) {
Ok(seeds) => seeds.into_iter().fold(
(Stats::default(), Seeds::default()),
|(mut stats, mut seeds), node| {
@ -1316,7 +1321,6 @@ where
stats.disconnected += 1;
}
}
(stats, seeds)
},
),
@ -1324,12 +1328,6 @@ where
return Err(Error::Routing(err));
}
};
debug!(
target: "service",
"Found {} connected seed(s) and {} disconnected seed(s) for {}",
stats.connected, stats.disconnected, rid
);
Ok(seeds)
}