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
Q uses process.nextTick instead of setImmediate in Node 0.10.x #541
Comments
+1 I too just started having the same exact problem. I'm also processing large amounts of data, using recursive promises, to elegantly handle both rate limiting and calls for subsequent pages where I don't know where the end is. It hums along great for several hours (was watching |
On this note I should note a separate relevant, IE has flawed handling of its setImmediate function. In some cases setTimeout loops and DOM modifications can result in setImmediate callbacks never being called. |
@dantman: that's a valid concern that should be taken into consideration, but just in the interest of debugging this: at least for my case, it's entirely in a server-side environment with no front-end interaction. |
@joe-spanning: Thanks for logging this issue, you saved me some debugging time. I am using the exact same pattern. My code looks like:
It seems I can work around the problem by inserting a delay of 1ms:
|
+1 |
+1, this is a bad design that produces heavy effects when application load increases, late in development flow :-( |
I am using Q 1.0.1 and Node.js 0.10.24
I have a application that uses Q to recursively process large amounts of data using the following pattern:
If there is a large amount of data to process in this way, I eventually get the error:
This error is not caught by my
fail
handler function, so I cannot recover from it. It comes across as an uncaught exception in Node. However, this is not the point of me creating the ticket.The error states that
setImmediate
should be used instead ofprocess.nextTick
. Looking at the source of q.js lines 158 - 177:It prefers process.nextTick to setImmediate.
If would be nice if this code was changed to use
setImmediate
, or if I could configure Q to prefersetImmediate
overprocess.nextTick
via an environment variable.The text was updated successfully, but these errors were encountered: