node: Simplify and fix fetch dequeueing

There was redundant code and a missing `break`.
This commit is contained in:
cloudhead 2024-04-08 12:48:49 +02:00
parent bd8e0ebcda
commit 976b58ba7a
No known key found for this signature in database
1 changed files with 8 additions and 11 deletions

View File

@ -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;
}
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");
if let Some(refs) = NonEmpty::from_vec(refs_at) {
// 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;
}
}
}