acme2: add a retry to getDirectory, since users are reporting a 429

(cherry picked from commit 4954b94d4a)
This commit is contained in:
Girish Ramakrishnan
2021-03-18 22:32:21 -07:00
parent 3b69e4dcec
commit 636d1f3e20
+1 -1
View File
@@ -572,7 +572,7 @@ Acme2.prototype.acmeFlow = function (hostname, domain, callback) {
Acme2.prototype.getDirectory = function (callback) {
const that = this;
request.get(this.caDirectory, { json: true, timeout: 30000 }, function (error, response) {
request.retry(5).get(this.caDirectory, { json: true, timeout: 30000 }, function (error, response) {
if (error) return callback(new BoxError(BoxError.NETWORK_ERROR, `Network error getting directory: ${error.message}`));
if (response.statusCode !== 200) return callback(new BoxError(BoxError.EXTERNAL_ERROR, 'Invalid response code when fetching directory : ' + response.statusCode));