From df1e3e6129a181af2d8ef1982da4d061429abc26 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Mon, 22 Jun 2026 17:52:58 +0100 Subject: [PATCH] fetcher/state: Extend test for same RID, different nodes The extension of the test shows that Node B's fetch cannot be dequeued because the RID is in the active fetch set. It can then be dequeued once Node A has been fetched from. --- .../src/fetcher/test/state/command/fetch.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/radicle-protocol/src/fetcher/test/state/command/fetch.rs b/crates/radicle-protocol/src/fetcher/test/state/command/fetch.rs index cd8189a1..16580030 100644 --- a/crates/radicle-protocol/src/fetcher/test/state/command/fetch.rs +++ b/crates/radicle-protocol/src/fetcher/test/state/command/fetch.rs @@ -101,6 +101,17 @@ fn fetch_same_repo_different_nodes_queues_second() { let active = state.get_active_fetch(&repo_1); assert!(active.is_some()); assert_eq!(*active.unwrap().from(), node_a); + + // Cannot dequeue for node_b since the repo is active + assert!(state.dequeue(&node_b).is_none()); + + // Clearing the orphaned entry (as a fix, or a restart, would) unblocks it. + state.fetched(command::Fetched { + from: node_a, + rid: repo_1, + }); + let dequeued = state.dequeue(&node_b).expect("repo is fetchable again"); + assert_eq!(dequeued.rid, repo_1); } #[test]