Skip to content

RateLimit track_request decrements counter before confirming request succeeds #581

Description

@sdghsdkjlas27-dotcom

rate_limit.rb lines 47-49: track_request decrements @remaining/@searchleft BEFORE the HTTP call is made. If the HTTP call fails (network error, timeout, 401), the counter is already decremented but no actual request was consumed. The sync method only runs in on_complete, which doesn't fire on connection errors.

REPRODUCTION: Make a request that fails with a connection error; the counter is still decremented.

IMPACT: Rate limit counter becomes overly pessimistic; could trigger premature off_quota? when quota is actually still available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions