diff options
Diffstat (limited to 'src/swarm/relay.rs')
| -rw-r--r-- | src/swarm/relay.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/swarm/relay.rs b/src/swarm/relay.rs index 087e028..2fa5f5f 100644 --- a/src/swarm/relay.rs +++ b/src/swarm/relay.rs @@ -81,6 +81,7 @@ pub(crate) async fn announce(state: &AppState, from: &str) { /// round with a single sender skips it; with several, each lacks the others' changes, /// so every neighbour is told. async fn announce_now(state: &AppState, senders: &HashSet<String>) { + state.stats.announce_round(); let skip = match senders.len() { 1 => senders.iter().next().cloned(), _ => None, @@ -165,7 +166,13 @@ pub(crate) async fn pull_if_behind( Some((other, since)) if other != peer && now < *since + PULL_TIMEOUT ); if busy { - pulling.waiting.insert(peer.to_owned(), remote.clone()); + if pulling + .waiting + .insert(peer.to_owned(), remote.clone()) + .is_none() + { + state.stats.pull_queued(); + } return false; } pulling.current = Some((peer.to_owned(), now)); @@ -174,6 +181,7 @@ pub(crate) async fn pull_if_behind( // Automerge asks for whatever these heads need that we don't have. peer_state.lock().await.sync.pull_from(theirs); + state.stats.pull_started(); debug!(peer = %peer, "Neighbour has changes we lack; pulling"); let _ = state .sync_events |
