You can waterfall two waterfalls

function createWaterfall(commands) {
   return function(callback) {
     Async.waterfall(commands, callback);
   }
}

var waterfalls = [createWaterfall(readCommands), 
createWaterfall(writeCommands)];

Async.waterfall(waterfalls, function(err) {
  //final result
});


Something like that


> On Dec 17, 2013, at 4:42 PM, Reza Razavipour <[email protected]> 
> wrote:
> 
> I have a set of read commands that I have to in sequence. Any fails, 
> processing stops.
> 
> readCommands is an array of read functions...
>         async.waterfall(readCommands, function(err) {
>             if (err) {
>                 console.log(err);
>                 res.send(500, { error : err.toString() });
>                 return;
>             }
>             else {
>                 console.log('we determined the state to which we have to 
> rollback to');
>             }
>         });
> 
> at this point, I know what I started with. Now I want to do the write commands
> 
>         async.waterfall(writeCommands, function(err) {
>             if (err) {
>                 console.log(err);
>                 res.send(500, { error : err.toString() });
>                 return;
>             }
>             else {
>                 console.log('we succeeded with all the write commands...');
>             }
>         });
> 
> the arrays readCommands and writeCommands entries are radically different so 
> very hard to combine them. But I DO for the first waterfall to finish before 
> I go to the next one.
> How do I make a "waterfall" out of the existing two?
> 
> -- 
> -- 
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to