Skip to content

Invoke iterate() via async.setImmediate() in async.eachSeries() #308

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

Closed
wants to merge 1 commit into from

Conversation

boutell
Copy link
Contributor

@boutell boutell commented May 9, 2013

Currently if the iterator function happens to invoke the callback and then return rather than invoking the callback from some further asynchronous call, which is common if it determines it is not interested in this particular item, the stack depth increases. If a large percentage of invocations do this, the stack will eventually crash. Wrapping the call to iterate() in async.setImmediate() resolves the issue, and seems more natural than requiring every instance of code that utilizes async.eachSeries() to wrap its direct invocations of the callback.

… stack if the iterator function sometimes invokes the callback directly with 'return callback();'
@boutell
Copy link
Contributor Author

boutell commented May 20, 2013

Duplicate of #296

@boutell boutell closed this May 20, 2013
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.

1 participant