Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Improve fetch logging
cloudhead committed 2 years ago
commit e55c86f1ce9e69cf3121ba7bead717f5faafe674
parent 6ff4efebedd046a59b385d70f34d153bcd3acb57
2 files changed +29 -10
modified radicle-node/src/service.rs
@@ -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
modified radicle-node/src/service/io.rs
@@ -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,
        });
    }