From ab776a70a5db3410500bbab63703cef5ef8c0cb2 Mon Sep 17 00:00:00 2001 From: Darsh Patel Date: Tue, 7 Apr 2026 10:20:25 -0700 Subject: [PATCH] add resetBudget() to LeakyBucketRateLimit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a public method to fully reset the retry budget (zero consumed budget and stop any active restore interval). This is needed by river-manager to reset the budget when a client transitions from background to foreground — previous failures during OS backgrounding shouldn't count against the fresh reconnection attempt. --- transport/rateLimit.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/transport/rateLimit.ts b/transport/rateLimit.ts index 2e6901eb..17a2d96b 100644 --- a/transport/rateLimit.ts +++ b/transport/rateLimit.ts @@ -127,6 +127,11 @@ export class LeakyBucketRateLimit { this.intervalHandle = undefined; } + resetBudget() { + this.stopLeak(); + this.budgetConsumed = 0; + } + close() { this.stopLeak(); }