Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@zachborboa
Copy link
Collaborator

Fixing the rate limit when a sleep() is used in a setRetry() function.

#863

ricnava00 and others added 3 commits November 15, 2025 14:13
If $elapsed_seconds > $this->intervalSeconds the first time hasRequestQuota() is called, rateLimitReached is never set to true and the limit is not enforced
This can happen if the rate limit is set in a callback function some time after starting

I completely removed $rateLimitReached since its only use was in the removed condition check

Alternatively, it should be possible to reinitialize currentStartTime when setRateLimit is called, but I still don't really see the usefulness of resetting the timer only when the limit was reached in the previous interval
@zachborboa zachborboa merged commit 4bf7292 into php-curl-class:master Nov 15, 2025
8 checks passed
@zachborboa zachborboa mentioned this pull request Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants