UNPKG

got-resume-next

Version:

Fetch via HTTP/HTTPS using got with automatic resume after network failures

10 lines (9 loc) 358 B
/* eslint-disable no-magic-numbers */ /** * Default backoff function * 1 sec on first attempt, increasing exponentially, doubling each time. * On 10th attempt is 512 secs = 8.5 mins. * @param {number} attempt - Attempt number (starting at 1) * @returns {number} - Wait (in milliseconds) */ module.exports = (attempt) => Math.pow(2, attempt - 1) * 1000