Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addResults should only callback once #356

Closed
wants to merge 1 commit into from

Conversation

matthewp
Copy link

@matthewp matthewp commented Feb 4, 2014

This will cause Node to crash because async throws an error as shown
here
. Fix
is to use isaac's once module to make sure we only call next one time.

This will cause Node to crash because async throws an error [as shown
here](https://github.com/caolan/async/blob/master/lib/async.js#L22). Fix
is to use isaac's once module to make sure we only call `next` one time.
@indexzero
Copy link
Member

👍 I'd prefer not to take an extra dependency but you are correct that the Logger should be more defensive about working with transports in this scenario. We can't trust that every transport only invoke it's own callback once.

@matthewp
Copy link
Author

I think this is a reasonable dependency to add though. It's 20 LOC, has 1 dependency of it's own (also very small) and is written by isaacs... but feel free to rewrite that logic yourself if you prefer.

indexzero added a commit that referenced this pull request Sep 24, 2014
@indexzero
Copy link
Member

This is paving over a larger problem of why these would get called multiple times in the first place. I would prefer to make this the sole exception and not a common occurrence. If we have to implement once-like functionality enough to need a module, we have other much bigger problems.

@indexzero indexzero closed this in b806389 Oct 6, 2014
@matthewp matthewp deleted the async-once branch October 6, 2014 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants