andismith / grunt-responsive-images

Produce images at different sizes for responsive websites.
http://www.andismith.com/grunt-responsive-images/
MIT License
719 stars 96 forks source link

Fix recursive function #87

Closed guillaumepalayer closed 8 years ago

guillaumepalayer commented 9 years ago

When you have a few thousands files and you run the option task newFilesOnly, an error occurs Maximum call stack size exceeded. Fix this issue by scheduling the "immediate" execution of callback after I/O events callbacks and before setTimeoutand setInterval — More info on setImmediate function here: http://nodejs.org/api/timers.html#timers_setimmediate_callback_arg

guillaumepalayer commented 9 years ago

Travis CI build passed if node --version 0.10.38

image

roobottom commented 8 years ago

@andismith Any chance of merging this in? I had the same issue as @guillaumepalayer and this fixed it for me too. (I've over 5,000 images.)

benurb commented 8 years ago

@guillaumepalayer This should work for Node 0.8, too.

(setImmediate || process.nextTick)(callback);

(Though I haven't tried it :smile: )

guillaumepalayer commented 8 years ago

@benurb Thank you for the trick. I will try that soon.