Skip to content

Commit f5adbce

Browse files
committed
fix: do not use exp backoff timeout
1 parent fb52e0c commit f5adbce

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/utils.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ const debugVerbose = require('debug')('netlify-plugin-cypress:verbose')
99
*/
1010
const ping = (url, timeout) => {
1111
debug('pinging "%s" for %d ms max', url, timeout)
12+
const start = +new Date()
13+
1214
return got(url, {
1315
retry: {
1416
limit: 30,
15-
calculateDelay({attemptCount, retryOptions, error, computedValue}) {
16-
debugVerbose(`attempt ${attemptCount} ${computedValue}ms ${error.message}`)
17+
calculateDelay({attemptCount, retryOptions, error}) {
18+
const now = +new Date()
19+
const elapsed = now - start
20+
debugVerbose(`attempt ${attemptCount} ${elapsed}ms ${error.message}`)
1721

18-
if (computedValue > timeout) {
19-
debug('%s timed out', url)
20-
console.error('%s timed out', url)
22+
if (elapsed > timeout) {
23+
debug('%s timed out after %dms, timeout was %dms',
24+
url, elapsed, timeout)
25+
console.error('%s timed out after %dms, timeout was %dms',
26+
url, elapsed, timeout)
2127
return 0
2228
}
2329
return 1000

0 commit comments

Comments
 (0)