Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Simplify and fix fetch dequeueing
cloudhead committed 2 years ago
commit 976b58ba7a2622e134dd50704ecf7d5aa7a826e9
parent bd8e0ebcda8f6f06dc20641a71614e3778a43fea
1 file changed +8 -11
modified radicle-node/src/service.rs
@@ -1088,23 +1088,20 @@ where
        {
            debug!(target: "service", "Dequeued fetch for {rid} from session {from}..");

-
            // If no refs are specified, always do a full fetch.
-
            if refs_at.is_empty() {
-
                self.fetch(rid, from, FETCH_TIMEOUT, channel);
-
                return;
-
            }
-

-
            let repo_entry = self
-
                .policies
-
                .seed_policy(&rid)
-
                .expect("Service::dequeue_fetch: error accessing repo seeding configuration");
-

            if let Some(refs) = NonEmpty::from_vec(refs_at) {
+
                let repo_entry = self
+
                    .policies
+
                    .seed_policy(&rid)
+
                    .expect("Service::dequeue_fetch: error accessing repo seeding configuration");
+

+
                // Keep dequeueing if there was nothing to fetch, otherwise break.
                if self.fetch_refs_at(rid, from, refs, repo_entry.scope, FETCH_TIMEOUT, channel) {
                    break;
                }
            } else {
+
                // If no refs are specified, always do a full fetch.
                self.fetch(rid, from, FETCH_TIMEOUT, channel);
+
                break;
            }
        }
    }