From 7ec368b676c409f9f7f66d97a843ec3b9ccd37e5 Mon Sep 17 00:00:00 2001 From: Beinan Date: Thu, 8 Oct 2026 21:52:56 +0000 Subject: [PATCH] fix(master): pay back the claiming-pool gauge when the poller is aborted #348 incremented claiming before the etcd claim and decremented after. A poller aborted mid-claim (drain, shutdown, test teardown) skipped the decrement, leaving the gauge elevated. Hold the decrement in the same Drop guard #353 introduced for the running gauge. Refs #333. Review round 4, claiming-cancel gap. Co-Authored-By: Claude Fable 5 --- crates/lance-context-master/src/scheduler.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/lance-context-master/src/scheduler.rs b/crates/lance-context-master/src/scheduler.rs index 0700ff44..6d9b1a05 100644 --- a/crates/lance-context-master/src/scheduler.rs +++ b/crates/lance-context-master/src/scheduler.rs @@ -1229,7 +1229,10 @@ fn spawn_filtered_pool_poller( let Some(operation) = state.admission.try_admit() else { break; }; + // Held across the await so a poller aborted mid-claim (drain, + // shutdown, test teardown) still pays the gauge back. claiming.increment(1.0); + let claiming_hold = GaugeHold(claiming.clone()); let claim_start = std::time::Instant::now(); let claim = if resident_only { state @@ -1239,7 +1242,7 @@ fn spawn_filtered_pool_poller( } else { state.task_store.claim_next_of_kinds(kinds).await }; - claiming.decrement(1.0); + drop(claiming_hold); match claim { Ok(Some(claim)) => { let claim_elapsed = claim_start.elapsed();