mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
HETZNER: better rate limit handling (#936)
* HETZNER: better rate limit handling - Hetzner is using a Proxy service 'kong' which broadcasts it limits - honor 'Retry-After' of 429 responses - delay requests per-se: see the amended docs for details Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * HETZNER: apply review feedback: store quotaName as lower case Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com> Signed-off-by: Jakob Ackermann <das7pad@outlook.com> Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
@@ -40,9 +40,19 @@ func New(settings map[string]string, _ json.RawMessage) (providers.DNSServicePro
|
||||
api.apiKey = settings["api_key"]
|
||||
|
||||
if settings["rate_limited"] == "true" {
|
||||
// backwards compatibility
|
||||
settings["start_with_default_rate_limit"] = "true"
|
||||
}
|
||||
if settings["start_with_default_rate_limit"] == "true" {
|
||||
api.startRateLimited()
|
||||
}
|
||||
|
||||
quota := settings["optimize_for_rate_limit_quota"]
|
||||
err := api.requestRateLimiter.setOptimizeForRateLimitQuota(quota)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unexpected value for optimize_for_rate_limit_quota: %w", err)
|
||||
}
|
||||
|
||||
return api, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user