From f541ec4260fe94df52bd4f3028b375a1e5d7621e Mon Sep 17 00:00:00 2001 From: jim Date: Tue, 30 Jun 2026 21:22:12 -0500 Subject: [PATCH] fix: correctly detect rate-limit state for single-key API pools IsAllRateLimited() short-circuited true for any pool with 0 or 1 keys, with minRetrySeconds left at 0 regardless of whether that key was actually rate-limited. SleepUntilAnyAvailable() checks "minRetry <= 0" to decide whether to skip sleeping, so with exactly one key it always skipped the wait and let callers hammer the API again immediately after a 429, even mid-cooldown. The per-key loop already computes this correctly for any key count; the special case only needs to cover the true no-keys edge case, where there's nothing to wait on. --- URLNotesGrabberCORE/DataAccess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/URLNotesGrabberCORE/DataAccess.cs b/URLNotesGrabberCORE/DataAccess.cs index 3241656..44f695c 100644 --- a/URLNotesGrabberCORE/DataAccess.cs +++ b/URLNotesGrabberCORE/DataAccess.cs @@ -2626,7 +2626,7 @@ namespace URLNotesGrabberCORE { minRetrySeconds = 0; if (!_usePool || _overrideKey != null) return false; - if (_keys.Count <= 1) return true; + if (_keys.Count == 0) return false; var now = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); bool all = true;