Skip to content

Commit

Permalink
Only announce to new peers when polling storage
Browse files Browse the repository at this point in the history
Problem: whenever a storage operation wakes us we announce the new
document to all the peers we are connected to. This was intended to
announce documents when loading, but it means we also announce every
time we save.

Solution: only announce to peers whom we do not currently have a
connection when polling storage.
  • Loading branch information
alexjg committed Dec 11, 2023
1 parent 7ecbdf0 commit 82f8ac6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,10 +1829,11 @@ impl Repo {
&self.repo_id,
);
if info.state.should_sync() {
let remotes = self.remote_repos.keys().filter(|k| !info.peer_connections.contains_key(k));
// Send a sync message to all other repos we are connected
// with and with whom we should share this document
Self::enqueue_share_decisions(
self.remote_repos.keys(),
remotes,
&mut self.pending_share_decisions,
&mut self.share_decisions_to_poll,
self.share_policy.as_ref(),
Expand Down

0 comments on commit 82f8ac6

Please sign in to comment.