1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

CSCGLOBAL: Be less noisy about rate limit delays (#2686)

This commit is contained in:
Tom Limoncelli
2023-12-05 10:02:55 -05:00
committed by GitHub
parent 57216f07f1
commit 4e8fb894ef

View File

@@ -647,7 +647,7 @@ func (client *providerClient) geturl(url string) ([]byte, error) {
// Default CSCGlobal rate limit is twenty requests per second
var backoff = time.Second
const maxBackoff = time.Second * 15
const maxBackoff = time.Second * 25
retry:
resp, err := hclient.Do(req)
@@ -666,9 +666,9 @@ retry:
if string(bodyString) == "Requests exceeded API Rate limit." {
// a simple exponential back-off with a 3-minute max.
if backoff > 10 {
if backoff > (time.Second * 10) {
// With this provider backups seem to be pretty common. Only
// announce it when the problem gets really bad.
// announce it for long delays.
printer.Printf("Delaying %v due to ratelimit (CSCGLOBAL)\n", backoff)
}
time.Sleep(backoff)