Repository navigation
docs(rate_limiter): fix check() docstring to match recording behavior - #4233
PratikDhanave (PratikDhanave) wants to merge 1 commit into
Conversation
check() said it "records the current call timestamp regardless of the outcome", but a rejected call returns False before dq.append(now), so rejected calls are not recorded. The code is the correct sliding-window behavior (recording rejects would let a retrying-over-limit caller extend its own lockout); only the docstring was wrong. Doc-only, no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Pratik Dhanave <i.pratikdhanave@gmail.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
|
🟡 Contributor Check: MEDIUM
Automated check by AGT Contributor Check. |
|
The docstring change matches the code: check() returns False before appending, so rejected calls are not recorded, and a probe with limit 2 shows the deque staying at two entries through rejected retries. Tests pass (142). Before I approve, please replace the description with the repository PR template and complete it, in particular Type of Change, Packages Affected, Checklist and the AI Assistance attestations, since the commit records Claude Code as co-author. Same ask as on #4226. |
RateLimiter.check()'s docstring says it "Records the current call timestamp regardless of the outcome." But whenlen(dq) >= limitthe methodreturn Falsebeforedq.append(now)— rejected calls are not recorded.The code's behavior is the correct sliding-window semantics (recording rejects would let a caller that keeps retrying while over the limit extend its own lockout past the window), and the existing tests encode the no-record behavior. So the defect is purely the docstring.
Doc-only;
pytestrate-limiter suite (16 tests) passes.🤖 Generated with Claude Code