| |
} else {
|
| |
// Finally, announce the refs. This is useful for nodes to know what we've synced,
|
| |
// beyond just knowing that we have added an item to our inventory.
|
| - |
if let Err(e) = self.announce_refs(rid, doc.into(), namespaces, false) {
|
| + |
if let Err(e) = self.announce_refs(rid, doc.into(), namespaces) {
|
| |
error!(target: "service", "Failed to announce new refs: {e}");
|
| |
}
|
| |
}
|
| |
doc: Doc,
|
| |
namespaces: impl IntoIterator<Item = NodeId>,
|
| |
) -> Result<(Vec<RefsAt>, Timestamp), Error> {
|
| - |
let (refs, timestamp) = self.announce_refs(rid, doc, namespaces, true)?;
|
| + |
let (refs, timestamp) = self.announce_refs(rid, doc, namespaces)?;
|
| |
|
| |
// Update refs database with our signed refs branches.
|
| |
// This isn't strictly necessary for now, as we only use the database for fetches, and
|
| |
rid: RepoId,
|
| |
doc: Doc,
|
| |
remotes: impl IntoIterator<Item = NodeId>,
|
| - |
own: bool,
|
| |
) -> Result<(Vec<RefsAt>, Timestamp), Error> {
|
| + |
let local = *self.nid();
|
| |
let (ann, refs) = self.refs_announcement_for(rid, remotes)?;
|
| |
let timestamp = ann.timestamp();
|
| |
let peers = self.sessions.connected().map(|(_, p)| p);
|
| |
|
| |
// Update our sync status for our own refs. This is useful for determining if refs were
|
| |
// updated while the node was stopped.
|
| - |
for r in refs.iter().filter(|r| own || r.remote == ann.node) {
|
| + |
for r in refs
|
| + |
.iter()
|
| + |
.filter(|r| r.remote == local || r.remote == ann.node)
|
| + |
{
|
| |
info!(
|
| |
target: "service",
|
| |
"Announcing refs {rid}/{r} to peers (t={timestamp})..",
|