From 37ed87f9c18c8d4f37a86e5503e6cc2870b215e4 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 27 Dec 2023 12:23:09 +0100 Subject: [PATCH] route53: retry on rate limit route53 has a limit of 5 req/sec/region - https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html#limits-api-requests see https://forum.cloudron.io/topic/10656/improve-dns-updates-to-avoid-rate-limits/ --- CHANGES | 2 ++ src/dns/route53.js | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 8bf48aba3..da3f5f248 100644 --- a/CHANGES +++ b/CHANGES @@ -2722,3 +2722,5 @@ [7.6.3] * postgres: do not clear search_path for restore +* route53: retry on rate limit errors + diff --git a/src/dns/route53.js b/src/dns/route53.js index 6b6fcd0c5..1d61ccf54 100644 --- a/src/dns/route53.js +++ b/src/dns/route53.js @@ -39,7 +39,12 @@ function getDnsCredentials(domainConfig) { const credentials = { accessKeyId: domainConfig.accessKeyId, secretAccessKey: domainConfig.secretAccessKey, - region: domainConfig.region + region: domainConfig.region, + maxRetries: 20, + // route53 has a limit of 5 req/sec/region - https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html#limits-api-requests + retryDelayOptions: { + customBackoff: (/* retryCount, error */) => 3000 // constant backoff - https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#retryDelayOptions-property + }, }; if (domainConfig.endpoint) credentials.endpoint = new AWS.Endpoint(domainConfig.endpoint);