retry-until
Just a way to keep calling a function as long as it's throwing, for some
period of time.
If the function returns a promise, it'll keep retrying the promise as long
as it keeps throwing, for the time specified.
USAGE
const retryUntil = require('retry-until')
const retryFor1Second = retryUntil(1000)
const retryFor10Seconds = retryUntil(10000)
retryFor1Second(syncFunctionThatSometimesThrowsForAWhile, 'some', 'args')
const result = await retryFor10Seconds(asyncFunctionThatSometimesRejects, 'some', 'other', 'args')
API
retryUntil(duration) -> Function
Returns a function that will take a function and some arguments, and then
run the function repeatedly for up to duration milliseconds.