From 40908a8e14b4d8f8a28c14b74ed865c5837d5f46 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 28 Oct 2026 16:38:03 +0100 Subject: [PATCH] connector-spend: drop the duplicated admission_clock Co-Authored-By: Claude Opus 5.5 --- crates/model-connector/src/service.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/crates/model-connector/src/service.rs b/crates/model-connector/src/service.rs index 6bd7e22..5cee371 100644 --- a/crates/model-connector/src/service.rs +++ b/crates/model-connector/src/service.rs @@ -274,24 +274,6 @@ fn admission_clock( now_unix_ms.max(newest.saturating_mul(spend_window_ms)) } -/// The clock a request is admitted at: `now`, held monotonic per caller. A -/// caller's window never moves back, so a clock that steps back (or a boot -/// with the clock behind a recorded window) cannot reopen spent budget: the -/// request is admitted into the caller's newest recorded window. The record -/// stores this value, so the window re-derives from the records at open. -fn admission_clock( - window_spend: &HashMap>, - caller_runtime_id: &str, - now_unix_ms: u64, - spend_window_ms: u64, -) -> u64 { - let newest = window_spend - .get(caller_runtime_id) - .and_then(|windows| windows.keys().next_back().copied()) - .unwrap_or(0); - now_unix_ms.max(newest.saturating_mul(spend_window_ms)) -} - /// Drops the windows of `caller_runtime_id` that nothing can still read: /// those before `floor` that hold no live request's reservation. Admission /// reads the current window alone, and a live request settles into the window