CLOUDNS: pause when API fails due to rate limit#3962
Merged
tlimoncelli merged 2 commits intoStackExchange:mainfrom Jan 6, 2026
Merged
CLOUDNS: pause when API fails due to rate limit#3962tlimoncelli merged 2 commits intoStackExchange:mainfrom
tlimoncelli merged 2 commits intoStackExchange:mainfrom
Conversation
Contributor
|
CC @pragmaton |
Contributor
|
Looks good! Thanks for fixing this! |
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.
There was already a Limiter in use here to keep the rate of requests below the apparent limit.
The ClouDNS API doesn't give any sort of proper API response when rate limit is reached. It's a 200 status code and an error message in the JSON body, and no headers that would help to track or back off for the right amount of time.
There was a comment in the implementation that mentions an undocumented 10-per-second limit, while the error message they give today says that the limit is 20 per second. I kept the settings on the Limiter the same since 10 per second should be plenty fast.
But it will now retry the request when the rate limit is reached. At the same time, it "steals" some reservations on
rate.Limiterto quiet other concurrent ClouDNS API calls for about half a second. This seems to be plenty to fix my rate-limit issues. (I tested with 20 domains with ClouDNS as both registrar and DNS provider using the functionality in #3961.)When rate limit is reached, it emits a warn-level message. This follows a pattern I see in
adguardhomeanddesecproviders but I don't love it—it's less important and less actionable than other warn-level messages in the project.