2020-02-11 20:50:34 +03:00
|
|
|
const promiseRetry = require('promise-retry')
|
|
|
|
|
|
|
|
async function uniformRetry(f) {
|
|
|
|
return promiseRetry(f, {
|
|
|
|
forever: true,
|
|
|
|
factor: 1,
|
|
|
|
minTimeout: 500
|
2019-05-06 14:12:53 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-02-11 20:50:34 +03:00
|
|
|
async function sleep(timeout) {
|
|
|
|
return new Promise(res => setTimeout(res, timeout))
|
|
|
|
}
|
|
|
|
|
2019-05-06 14:12:53 +03:00
|
|
|
module.exports = {
|
2020-02-11 20:50:34 +03:00
|
|
|
uniformRetry,
|
|
|
|
sleep
|
2019-05-06 14:12:53 +03:00
|
|
|
}
|