You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created water-pipe [alpha] based on waterfall. However I have seen several issues ( #815, #559, #535 ) related to stopping people from calling multiple times the callback, however I'm opening one to keep allowing this:
// One of the tasks as an examplefunction(data,callback){callback(null,'first');setTimeout(callback.bind(false,'second'),10000);}
In this way we allow the waterfall to "branch", so it can follow two different ways at the same time. This is useful in many situations, for example when crawling a site and we want to check later without DDOS'ing someone if a link is already up (above example).
In this way the next task is executed for both branches, which is desirable for this kind of situations. Also it'd be desirable if the last callback was also executed several times, one per branch.
If we remove this feature as suggested in some issues, is there any option to make this to work? Or should I work from the current codebase (without jumping to 2.x)?
From my point of view, if a user calls a callback two times, it should just be called two times, as in any normal function. It just happens that this callbacks keeps some state going on.
The text was updated successfully, but these errors were encountered:
franciscop
changed the title
Allow for multiple callbacks in waterfall
Allow for multiple callbacks
Dec 23, 2015
We've been trying to standardize functions async works with as functions that call their callback exactly once. Calling a callback more than once is often a source of bugs for many people -- we want to guard against it.
If you want to call a callback multiple times, what you're describing sounds more like a stream. The use of the term pipe also completes the picture. There are also FRP-style libraries like RxJS and BaconJs (and Highlander) that make working with streams really easy -- they have a similar feel to your water-pipe helper.
I created water-pipe [alpha] based on waterfall. However I have seen several issues ( #815, #559, #535 ) related to stopping people from calling multiple times the callback, however I'm opening one to keep allowing this:
In this way we allow the waterfall to "branch", so it can follow two different ways at the same time. This is useful in many situations, for example when crawling a site and we want to check later without DDOS'ing someone if a link is already up (above example).
In this way the next task is executed for both branches, which is desirable for this kind of situations. Also it'd be desirable if the last callback was also executed several times, one per branch.
If we remove this feature as suggested in some issues, is there any option to make this to work? Or should I work from the current codebase (without jumping to 2.x)?
From my point of view, if a user calls a callback two times, it should just be called two times, as in any normal function. It just happens that this callbacks keeps some state going on.
The text was updated successfully, but these errors were encountered: