Skip to content

Commit

Permalink
reordering levels
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZ99 committed Dec 13, 2011
1 parent 312d401 commit a2dc156
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/generic-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ exports.Pool = function (factory) {
function () {};



factory.max = Math.max(factory.max, 1);

/**
Expand Down Expand Up @@ -156,7 +155,7 @@ exports.Pool = function (factory) {
toKeep.push(availableObjects[i]);
} else {
// The client timed out, call its destroyer.
log("removeIdle() destroying obj - now:" + now + " timeout:" + timeout, 'info');
log("removeIdle() destroying obj - now:" + now + " timeout:" + timeout, 'verbose');
me.destroy(availableObjects[i].obj);
}
}
Expand Down Expand Up @@ -215,16 +214,16 @@ exports.Pool = function (factory) {
objWithTimeout = null,
err = null,
waitingCount = waitingClients.size();
log("dispense() clients=" + waitingCount + " available=" + availableObjects.length, 'verbose');
log("dispense() clients=" + waitingCount + " available=" + availableObjects.length, 'info');
if (waitingCount > 0) {
if (availableObjects.length > 0) {
log("dispense() - reusing obj", 'info');
log("dispense() - reusing obj", 'verbose');
objWithTimeout = availableObjects.shift();
adjustCallback(waitingClients.dequeue(), err, objWithTimeout.obj);
}
else if (count < factory.max) {
count += 1;
log("dispense() - creating obj - count=" + count, 'info');
log("dispense() - creating obj - count=" + count, 'verbose');
factory.create(function () {
var cb = waitingClients.dequeue();
if (arguments.length > 1) {
Expand Down Expand Up @@ -311,7 +310,7 @@ exports.Pool = function (factory) {
* released.
*/
me.drain = function(callback) {
log("draining", 'verbose');
log("draining", 'info');

// disable the ability to put more work on the queue.
draining = true;
Expand Down

0 comments on commit a2dc156

Please sign in to comment.