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 13:12:53 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-02-11 20:50:34 +03:00
|
|
|
async function sleep(timeout) {
|
|
|
|
return new Promise(res => setTimeout(res, timeout))
|
|
|
|
}
|
|
|
|
|
2019-05-06 13:12:53 +02:00
|
|
|
module.exports = {
|
2020-02-11 20:50:34 +03:00
|
|
|
uniformRetry,
|
|
|
|
sleep
|
2019-05-06 13:12:53 +02:00
|
|
|
}
|