Thanks for the reply. My goal was to fetch the MD5 and Server information
asynchronously.
1. Get a list of data
2. In parallel foreach item in the list fetch server and MD5 data
asynchronously
3. Stuff object in DB.
I think what it actually comes down to is that I need to create a new Seq
chain inside the parEach step to handle the fetching of the MD5 and Server
data.
On Monday, July 23, 2012 6:29:34 AM UTC-4, Evgeny Bogdanov wrote:
>
> Your parEach, .par and .par are actually executed all in parallel
> with the same stack passed from .flatten() command
>
> You should move your processing of every item (md5s, servers) into parEach
> like this.
> i don't see why you want to make this calls async, since you just push
> object into array
>
> .flatten().parEach(function(row, i){
>> console.log('[INFO]', 'Par Each');
>>
>> var _this = this;
>> var cncInfo = new CNCInfo();
>> cncInfo._id = row.entry_id;
>> cncInfo.entry_id = row.entry_id;
>> cncInfo.entry_type = row.entry_type;
>>
>> console.log('[A]',cncInfo);
>>
>> // part 1
>> //cncInfo.md5s.push(cncInfo.entry_id);
>>
>> // part 2
>> //cncInfo.servers.push(cncInfo.entry_id);
>>
>> DbDest.write('botnet_cnc_info', cncInfo, function(err, resp){
>> if(err){
>> _this(err);
>> }else{
>> _this(null, resp);
>> }
>> });
>> }).seq('final', function(resp){
>>
>
>
>> cleanup(null, resp);
>>
> })
>
--
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