Closed thefourtheye closed 7 years ago
Bump! cc @coopernurse @sandfox
Ping!
sorry, this one has just passed me by completely. Looks good, but could swap the nextTick
for a setTimeout(/* */, 0)
.
nextTick
can lead to I/O starvation (although pretty unlikely here i admit) and it also has changeable behaviour across different node versions. Whilst setTimeout
isn't SUPER efficient, it shouldn't matter in this case, and we can't guarantee that we're running in a version of nodejs that has setImmediate
. (Although feel free to make a little wrapper function that detects if we do have it and then uses else fallsback to setTimeout
)
Also - As the master branch is now v3 of the library, I'll need to fork off of a brach for the v2 so could you target the PR there (I'll update this issue with it once I've done it)
V2 branch here -> https://github.com/coopernurse/node-pool/tree/v2.4
Closing in favor of #156
The drain function should always invoke the callback asynchronously. As it is, if the the first two conditions are not satisfied, then the callback will be executed synchronously.