node: Improve fetch logging

This commit is contained in:
cloudhead 2024-04-04 18:34:32 +02:00
parent 6ff4efebed
commit e55c86f1ce
No known key found for this signature in database
2 changed files with 29 additions and 10 deletions

View File

@ -957,7 +957,6 @@ where
return Err(TryFetchError::SessionCapacityReached);
}
let remotes = refs_at.len();
let fetching = fetching.or_insert(FetchState {
from,
refs_at: refs_at.clone(),
@ -965,11 +964,6 @@ where
});
self.outbox.fetch(session, rid, refs_at, timeout);
debug!(
target: "service",
"Fetch initiated for {rid} with {} ({remotes} remote(s))..", session.id
);
Ok(fetching)
}
@ -1435,6 +1429,11 @@ where
// Update sync status of announcer for this repo.
if let Some(refs) = message.refs.iter().find(|r| &r.remote == self.nid()) {
debug!(
target: "service",
"Refs announcement of {announcer} for {} contains our own remote at {} (t={})",
message.rid, refs.at, message.timestamp
);
match self.db.seeds_mut().synced(
&message.rid,
announcer,
@ -1453,6 +1452,12 @@ where
remote: *announcer,
at: refs.at,
});
} else {
debug!(
target: "service",
"Sync status of {announcer} was not updated for {}",
message.rid,
);
}
}
Err(e) => {
@ -1897,7 +1902,11 @@ where
// updated while the node was stopped.
// TODO: Move to `announce_own_refs`.
if let Some(refs) = refs.iter().find(|r| r.remote == ann.node) {
info!(target: "service", "Announcing local refs for {rid} to peers ({})..", refs.at);
info!(
target: "service",
"Announcing own refs for {rid} to peers ({}) (t={})..",
refs.at, ann.timestamp()
);
if let Err(e) = self
.db

View File

@ -120,18 +120,28 @@ impl Outbox {
pub fn fetch(
&mut self,
remote: &mut Session,
peer: &mut Session,
rid: RepoId,
refs_at: Vec<RefsAt>,
timeout: time::Duration,
) {
remote.fetching(rid);
peer.fetching(rid);
let refs_at = (!refs_at.is_empty()).then_some(refs_at);
if let Some(refs_at) = &refs_at {
debug!(
target: "service",
"Fetch initiated for {rid} with {peer} ({} remote(s))..", refs_at.len()
);
} else {
debug!(target: "service", "Fetch initiated for {rid} with {peer} (all remotes)..");
}
self.io.push_back(Io::Fetch {
rid,
refs_at,
remote: remote.id,
remote: peer.id,
timeout,
});
}