Comparing version 0.1.3 to 0.1.4
30
index.js
var Promise = require('bluebird'); | ||
var RECURSION_LIMIT = 100; | ||
function Tarn(opt) { | ||
function Pool(opt) { | ||
opt = opt || {}; | ||
@@ -69,19 +69,19 @@ | ||
Tarn.prototype.numUsed = function () { | ||
Pool.prototype.numUsed = function () { | ||
return this.used.length; | ||
}; | ||
Tarn.prototype.numFree = function () { | ||
Pool.prototype.numFree = function () { | ||
return this.free.length; | ||
}; | ||
Tarn.prototype.numPendingAcquires = function () { | ||
Pool.prototype.numPendingAcquires = function () { | ||
return this.pendingAcquires.length; | ||
}; | ||
Tarn.prototype.numPendingCreates = function () { | ||
Pool.prototype.numPendingCreates = function () { | ||
return this.pendingCreates.length; | ||
}; | ||
Tarn.prototype.acquire = function () { | ||
Pool.prototype.acquire = function () { | ||
var self = this; | ||
@@ -101,3 +101,3 @@ | ||
Tarn.prototype.release = function (resource) { | ||
Pool.prototype.release = function (resource) { | ||
for (var i = 0, l = this.used.length; i < l; ++i) { | ||
@@ -120,3 +120,3 @@ var used = this.used[i]; | ||
Tarn.prototype.check = function () { | ||
Pool.prototype.check = function () { | ||
var timestamp = now(); | ||
@@ -142,3 +142,3 @@ var newFree = []; | ||
Tarn.prototype.destroy = function() { | ||
Pool.prototype.destroy = function() { | ||
var self = this; | ||
@@ -171,3 +171,3 @@ | ||
Tarn.prototype._tryAcquireNext = function (recursion) { | ||
Pool.prototype._tryAcquireNext = function (recursion) { | ||
recursion = (recursion || 0) + 1; | ||
@@ -193,3 +193,3 @@ | ||
Tarn.prototype._acquireNext = function (recursion) { | ||
Pool.prototype._acquireNext = function (recursion) { | ||
while (this.free.length > 0 && this.pendingAcquires.length > 0) { | ||
@@ -225,3 +225,3 @@ var pendingAcquire = this.pendingAcquires[0]; | ||
Tarn.prototype._create = function () { | ||
Pool.prototype._create = function () { | ||
var self = this; | ||
@@ -252,3 +252,3 @@ | ||
Tarn.prototype._destroy = function (resource) { | ||
Pool.prototype._destroy = function (resource) { | ||
try { | ||
@@ -355,5 +355,5 @@ this.destroyer(resource); | ||
module.exports = { | ||
Tarn: Tarn, | ||
Pool: Pool, | ||
Promise: Promise, | ||
TimeOutError: Promise.TimeoutError | ||
TimeoutError: Promise.TimeoutError | ||
}; |
{ | ||
"name": "tarn", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Simple and robust resource pool for node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package