From 083fd19be84868ab3eb4be1e78a6a3eb7a612bb8 Mon Sep 17 00:00:00 2001 From: Eedrah Date: Mon, 3 Dec 2018 13:59:05 +1300 Subject: [PATCH] make polling try every 30s for 15m --- lib.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib.js b/lib.js index bcfb22b..3190e6d 100644 --- a/lib.js +++ b/lib.js @@ -11,8 +11,8 @@ const { URL } = require('url'); const generateRsa = () => RSA.generateKeypairAsync(2048, 65537, {}); -const pollUntilDeployed = (url, expectedContent, timeoutMs = 30 * 1000, retries = 10) => { - if (retries > 0) { +const pollUntilDeployed = (url, expectedContent, timeoutMs = 30 * 1000, attempts = 30) => { + if (attempts > 0) { return request.get({ url: url, simple: false // don't reject on 404 @@ -23,7 +23,7 @@ const pollUntilDeployed = (url, expectedContent, timeoutMs = 30 * 1000, retries // GitLab CI usually takes 50-80 seconds to build console.log(`Could not find challenge file. Retrying in ${ms(timeoutMs)}...`); return Promise.delay(timeoutMs).then(() => - pollUntilDeployed(url, expectedContent, timeoutMs * 2, retries - 1)); + pollUntilDeployed(url, expectedContent, timeoutMs, attempts - 1)); } }); } else {