diff options
Diffstat (limited to 'src/state')
| -rw-r--r-- | src/state/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs index fe71b7b..e815550 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -244,6 +244,9 @@ pub(crate) struct AppState { /// Something a joining node waits for may have happened: the swarm ID learned, the /// initial sync done, a rejoin ended, a seed found (`swarm::bootstrap`). pub(crate) join_progress: Arc<tokio::sync::Notify>, + /// Something happened that the peer worker's periodic checks may have to act on + /// (`swarm::peer::worker`): the document or a peer's state changed. + pub(crate) housekeeping: Arc<tokio::sync::Notify>, /// A peer said another epoch than this node's (`swarm::peer::epoch`): the remake /// worker looks whether to follow it (`remake::switch`). pub(crate) remake_wake: Arc<tokio::sync::Notify>, @@ -589,10 +592,12 @@ impl AppState { pub(crate) fn new_peer_state(&self, pk: &str) -> Arc<Mutex<PeerState>> { let leads = crate::swarm::pair::leads(self.local_id(), pk); self.peers_due.now(); + self.housekeeping.notify_one(); Arc::new(Mutex::new(PeerState::new(leads, &self.timing))) } pub(crate) fn notify_store_changed(&self) { + self.housekeeping.notify_one(); self.change_tx.send_modify(|version| { *version = version.wrapping_add(1); }); |
