Seed debug outputs cleanup (#460)
* DRY up * iterate 66% less * clarify debug! outputs * less verbose peer queuing Rationale: debug outputs that happen _a lot_ is nice if they're short and distinct, making them easier to pattern match / willfully ignore while reading through logs * update comment to mention last weeks' added usecases * .push() less
This commit is contained in:
+5
-8
@@ -122,15 +122,12 @@ impl PeerStore {
|
||||
peers.iter().take(count).cloned().collect()
|
||||
}
|
||||
|
||||
/// List all known peers (for the /v1/peers api endpoint)
|
||||
/// List all known peers
|
||||
/// Used for /v1/peers, for seed / sync (debug & if too few peers connected)
|
||||
pub fn all_peers(&self) -> Vec<PeerData> {
|
||||
let peers_iter = self.db
|
||||
.iter::<PeerData>(&to_key(PEER_PREFIX, &mut "".to_string().into_bytes()));
|
||||
let mut peers = vec![];
|
||||
for p in peers_iter {
|
||||
peers.push(p);
|
||||
}
|
||||
peers
|
||||
self.db
|
||||
.iter::<PeerData>(&to_key(PEER_PREFIX, &mut "".to_string().into_bytes()))
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
/// Convenience method to load a peer data, update its status and save it
|
||||
|
||||
Reference in New Issue
Block a user