fix: stop refresh cycle when GitHub rate limit is reached#134
Closed
CodeMatrix1 wants to merge 1 commit intoRocketChat:masterfrom
Closed
fix: stop refresh cycle when GitHub rate limit is reached#134CodeMatrix1 wants to merge 1 commit intoRocketChat:masterfrom
CodeMatrix1 wants to merge 1 commit intoRocketChat:masterfrom
Conversation
Author
|
Hello singli, I realise that the PR with backend changes would have conflicts with this one if merged, I will make sure that conflicts are resolved, Please let me know if the previous PRs needs to be merged to allow new PRs or if I can do anything to help with this slight hitch |
Member
|
we never have had rate limit problem. Thanks for the attempt, though. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stops the current refresh cycle when the GitHub API rate limit is reached, instead of continuing to issue requests for the remaining contributors in the same run.
This keeps the server alive, but avoids wasting requests and producing repeated skip/warning noise after rate limiting has already been detected.
Motivation
Once the GitHub API rate limit is exhausted, the current refresh loop continues processing contributors even though the remaining requests in that cycle are very likely to fail.
That leads to:
This change makes the refresh behavior more intentional: stop the current cycle early and wait for the next scheduled run.
Changes (high level)
src/server/util/API.jsrateLimitExceededflagAPI rate limit exceededmessageisRateLimitExceeded()resetRateLimitExceeded()src/server/refresh.jsPromise.mapSeries(...)so requests complete sequentially and the stop behavior applies cleanly[WARNING] Refresh cycle stopped because the GitHub API rate limit was reached.Why this is different from existing rate-limit logging
The existing API error handling logs the rate-limit message and returns from the individual request helper.
This change goes further by:
Tests
process doesnt exit above, only execution stops(did'nt know what to do)
No automated tests were added for this change since enough e2e support is lacking.
AI-assisted contribution disclosure - Mostly AI-generate
How to verify