From 976b58ba7a2622e134dd50704ecf7d5aa7a826e9 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Mon, 8 Apr 2024 12:48:49 +0200 Subject: [PATCH] node: Simplify and fix fetch dequeueing There was redundant code and a missing `break`. --- radicle-node/src/service.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/radicle-node/src/service.rs b/radicle-node/src/service.rs index c7069ab7..d84d82fa 100644 --- a/radicle-node/src/service.rs +++ b/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; } } }