The answer depends on the reason why the callback called multiple times, 
possible are:
- by design
- when multiple parallel running functions callback


The last one could happen f.e. one of them fails and calls back with an error, 
the other one calls back without error despite of the errored other one. In 
this case you can't ignore either the first one or the second one.

I had this situation often when dealing with event emitters and transforming 
the results into single callback style.

The only correct way is to fix the function which is causing this error.


Best,
Oleg Slobodskoi

http://www.facebook.com/oleg.slobodskoi
https://www.xing.com/profile/Oleg_Slobodskoi
https://twitter.com/oleg008
https://github.com/kof

Am 01.10.2013 um 07:17 schrieb jeevan kk <jeeva...@gmail.com>:

> I am using different 3rd party modules in my project. I have seen, in some 
> odd situations the 3rd party module which I am using is calling the callback 
> multiple times. 
> 
> Is there any general approach which I can follow so avoid such situations. 
> 
> -- 
> -- 
> 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 nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> 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 nodejs+unsubscr...@googlegroups.com.
> 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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
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 nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to