Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return storeFile(file).catch(function uploadToS3Failed(err) {
// default the current try to 0
currentTry = currentTry || 0;
if (currentTry >= maxRetryCount) {
return Promise.reject(err);
}
debug('error uploading to s3: ', err);
backoffInstance = backoffInstance || new Backoff(retryOpts);
return Promise
.delay(backoffInstance.next())
.then(function () {
return uploadFile(file, index, arrLength, ++currentTry, backoffInstance);
});
});
})
loadOpenIssues().then(() => cb(), err => cb(err))
}
const call = backoff.call(loadAllOpenIssues, err => {
if (err) {
logger.error('failed to fetch journals', err)
} else {
logger.info('successfully fetched journals')
}
})
call.retryIf(err => {
const willRetry = err.status === 503
logger.info('will retry to fetch journals', willRetry)
return willRetry
})
call.setStrategy(new backoff.FibonacciStrategy({
initialDelay: 1e3,
maxDelay: 60e3,
randomisationFactor: 0
}))
call.start()
}