Skip to content

Commit

Permalink
change the position of dispense and callback to ensure the time order
Browse files Browse the repository at this point in the history
  • Loading branch information
windyrobin committed Oct 22, 2012
1 parent 5e1455f commit 27bd81c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/generic-pool.js
Expand Up @@ -255,8 +255,10 @@ exports.Pool = function (factory) {
}
if (err) {
count -= 1;
dispense();
clientCb(err, obj);
process.nextTick(function(){

This comment has been minimized.

Copy link
@mscdex

mscdex Oct 23, 2012

Is the extra closure here necessary? Won't process.nextTick(dispense); work?

EDIT: Also, is the usage of process.nextTick here really necessary?

This comment has been minimized.

Copy link
@coopernurse

coopernurse Oct 23, 2012

Owner

Good question. I don't see why dispense() needs to be wrapped..

dispense();
});
} else {
if (clientCb) {
clientCb(err, obj);
Expand Down

0 comments on commit 27bd81c

Please sign in to comment.