Socket
Socket
Sign inDemoInstall

generic-pool

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generic-pool - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

test/GH-159-test.js

4

CHANGELOG.md
# Change Log
## [3.6.0] - Febuary 4 2019
- update docs (@chdh)
- fix #159 - pool.clear can no longer "skip" clearing up resources when called early in pool lifecycle (@sandfox)
## [3.5.0] - January 17 2019

@@ -4,0 +8,0 @@ - update nodejs versions tested by travis

20

lib/Pool.js

@@ -309,8 +309,13 @@ "use strict";

const factoryPromise = this._factory.create();
const wrappedFactoryPromise = this._Promise.resolve(factoryPromise);
const wrappedFactoryPromise = this._Promise
.resolve(factoryPromise)
.then(resource => {
const pooledResource = new PooledResource(resource);
this._allObjects.add(pooledResource);
this._addPooledResourceToAvailableObjects(pooledResource);
});
this._trackOperation(wrappedFactoryPromise, this._factoryCreateOperations)
.then(resource => {
this._handleNewResource(resource);
return null;
.then(() => {
this._dispense();
})

@@ -323,9 +328,2 @@ .catch(reason => {

_handleNewResource(resource) {
const pooledResource = new PooledResource(resource);
this._allObjects.add(pooledResource);
// TODO: check we aren't exceding our maxPoolSize before doing
this._dispatchPooledResourceToNextWaitingClient(pooledResource);
}
/**

@@ -332,0 +330,0 @@ * @private

@@ -20,4 +20,4 @@ "use strict";

* @param {Boolean} [opts.testOnBorrow=false]
* should the pool validate resources before giving them to clients. Requires that either
* `factory.validate` or `factory.validateAsync` to be specified.
* should the pool validate resources before giving them to clients. Requires that
* `factory.validate` is specified.
* @param {Boolean} [opts.testOnReturn=false]

@@ -24,0 +24,0 @@ * should the pool validate resources before returning them to the pool.

{
"name": "generic-pool",
"description": "Generic resource pooling for Node.JS",
"version": "3.5.0",
"version": "3.6.0",
"author": "James Cooper <james@bitmechanic.com>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -130,3 +130,3 @@ [![build status](https://secure.travis-ci.org/coopernurse/node-pool.png)](http://travis-ci.org/coopernurse/node-pool)

- `maxWaitingClients`: maximum number of queued requests allowed, additional `acquire` calls will be callback with an `err` in a future cycle of the event loop.
- `testOnBorrow`: `boolean`: should the pool validate resources before giving them to clients. Requires that either `factory.validate` or `factory.validateAsync` to be specified
- `testOnBorrow`: `boolean`: should the pool validate resources before giving them to clients. Requires that `factory.validate` is specified.
- `acquireTimeoutMillis`: max milliseconds an `acquire` call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.

@@ -133,0 +133,0 @@ - `fifo` : if true the oldest resources will be first to be allocated. If false the most recently released resources will be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. `boolean`, (default true)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc