It would be very helpful for debugging and testing purposes if async had a timeout that could be set be set on all async operators.
Use case would be
async._debug({timeout: 2000})
async.waterfall([
(next) => next(),
(next) => 'bad function'
], (err, res) => {
if(err){
throw err;
}
})
// Debug timeout of 2000ms occurred at {stack}
Or something like that
We already offer a timeout wrapper.
You could do something like:
let debugWrap = process.env.DEBUG ? async.timeout : _.identity;
let waterfall = debugWrap(async.waterfall);
waterfall([
(next) => {...}
(next) => 'bad function'
], (err, res) => {
if(err){
throw err;
}
})
I'd be disinclined to build this in to the lib, though.
Yep, @aearly solution is definitely the way to go
Most helpful comment
We already offer a
timeoutwrapper.You could do something like:
I'd be disinclined to build this in to the lib, though.