Skip to content
New issue

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

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

Already on GitHub? # to your account

eachSeries - stack size limitation #700

Closed
ghominejad opened this issue Jan 12, 2015 · 5 comments
Closed

eachSeries - stack size limitation #700

ghominejad opened this issue Jan 12, 2015 · 5 comments

Comments

@ghominejad
Copy link

var arr = [];
for (var i=0; i <= 5000; i++ ) {
    arr.push( i );
}
async.eachSeries(arr, function (i, cb){
    cb();
});

RangeError: Maximum call stack size exceeded

@aearly
Copy link
Collaborator

aearly commented Jan 12, 2015

See #66, #75, #110, #117, #133, #296, #413, #510, #573, #588, #590, #604, #622, #696 .

Your iterator is synchronous. You need to:

async.eachSeries(arr, function (i, cb){
    setImmediate(cb);
});

@ghominejad
Copy link
Author

Thank you

@wilywork
Copy link

wilywork commented Nov 18, 2016

`
async.eachSeries(arr, function (i, cb){
setImmediate(cb);
});

//Uncaught ReferenceError: setImmediate is not defined(…)
`

@hargasinski
Copy link
Collaborator

@wilywork see https://developer.mozilla.org/en/docs/Web/API/Window/setImmediate. If you're running this in a browser, you'll need to change it to:

async.eachSeries(arr, function (i, cb){
    async.setImmediate(cb);
});

@wilywork
Copy link

Thank you

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants