betolerant
let betolerant = require("betolerant"); betolerant(3 /*tries*/, 10000 /*timeout*/, function* { yield asyncOp(); yield sleep(1000); result = yield checkAsyncOpResult(); if (!result.failed) { throw Error("op failed"); }}).then(function(){ // done;}).catch(function(){ // all three attemps timed out or failed});