generic-pool
Advanced tools
Comparing version 3.6.0 to 3.6.1
# Change Log | ||
## [3.6.1] - Febuary 6 2019 | ||
- fix #251 - silence bluebird warning about side-effect only handler (@sandfox) | ||
- Pool.clear no longer resolves to pointless array on undefineds (@restjohn) | ||
## [3.6.0] - Febuary 4 2019 | ||
@@ -187,3 +191,5 @@ - update docs (@chdh) | ||
[unreleased]: https://github.com/coopernurse/node-pool/compare/v3.5.0...HEAD | ||
[unreleased]: https://github.com/coopernurse/node-pool/compare/v3.6.1...HEAD | ||
[3.6.1]: https://github.com/coopernurse/node-pool/compare/v3.6.0...v3.6.1 | ||
[3.6.0]: https://github.com/coopernurse/node-pool/compare/v3.5.0...v3.6.0 | ||
[3.5.0]: https://github.com/coopernurse/node-pool/compare/v3.4.2...v3.5.0 | ||
@@ -190,0 +196,0 @@ [3.4.2]: https://github.com/coopernurse/node-pool/compare/v3.4.1...v3.4.2 |
@@ -320,2 +320,6 @@ "use strict"; | ||
this._dispense(); | ||
// Stop bluebird complaining about this side-effect only handler | ||
// - a promise was created in a handler but was not returned from it | ||
// https://goo.gl/rRqMUw | ||
return null; | ||
}) | ||
@@ -620,3 +624,3 @@ .catch(reason => { | ||
).map(reflector); | ||
return this._Promise.all(reflectedDestroyPromises); | ||
return reflector(this._Promise.all(reflectedDestroyPromises)); | ||
}); | ||
@@ -623,0 +627,0 @@ } |
{ | ||
"name": "generic-pool", | ||
"description": "Generic resource pooling for Node.JS", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"author": "James Cooper <james@bitmechanic.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -260,2 +260,43 @@ "use strict"; | ||
tap.test("clear promise resolves with no value", function(t) { | ||
let resources = []; | ||
const factory = { | ||
create: function create() { | ||
return new Promise(function tryCreate(resolve, reject) { | ||
let resource = resources.shift(); | ||
if (resource) { | ||
resolve(resource); | ||
} else { | ||
process.nextTick(tryCreate.bind(this, resolve, reject)); | ||
} | ||
}); | ||
}, | ||
destroy: function() { | ||
return Promise.resolve(); | ||
} | ||
}; | ||
const pool = createPool(factory, { max: 3, min: 3 }); | ||
Promise.all([pool.acquire(), pool.acquire(), pool.acquire()]).then(all => { | ||
all.forEach(resource => { | ||
process.nextTick(pool.release.bind(pool), resource); | ||
}); | ||
}); | ||
t.equal(pool.pending, 3, "all acquisitions pending"); | ||
pool | ||
.drain() | ||
.then(() => pool.clear()) | ||
.then(resolved => { | ||
t.equal(resolved, undefined, "clear promise resolves with no value"); | ||
t.end(); | ||
}); | ||
process.nextTick(() => { | ||
resources.push("a"); | ||
resources.push("b"); | ||
resources.push("c"); | ||
}); | ||
}); | ||
tap.test("handle creation errors", function(t) { | ||
@@ -262,0 +303,0 @@ let created = 0; |
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
100941
2481