generic-pool
Advanced tools
Comparing version 3.1.1 to 3.1.2
# Change Log | ||
## [3.1.2] - November 22 2016 | ||
- Readme tidy up | ||
- Add missing changelog entry | ||
## [3.1.1] - November 18 2016 | ||
- Add Readme link for legacy branch | ||
## [3.1.0] - November 6 2016 | ||
@@ -129,3 +137,5 @@ - Inject dependencies into Pool to allow easier user extension | ||
======= | ||
[unreleased]: https://github.com/coopernurse/node-pool/compare/v3.1.0...HEAD | ||
[unreleased]: https://github.com/coopernurse/node-pool/compare/v3.1.2...HEAD | ||
[3.1.2]: https://github.com/coopernurse/node-pool/compare/v3.1.1...v3.1.2 | ||
[3.1.1]: https://github.com/coopernurse/node-pool/compare/v3.1.0...v3.1.1 | ||
[3.1.0]: https://github.com/coopernurse/node-pool/compare/v3.0.1...v3.1.0 | ||
@@ -132,0 +142,0 @@ [3.0.1]: https://github.com/coopernurse/node-pool/compare/v3.0.0...v3.0.1 |
{ | ||
"name": "generic-pool", | ||
"description": "Generic resource pooling for Node.JS", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"author": "James Cooper <james@bitmechanic.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -15,3 +15,3 @@ [![build status](https://secure.travis-ci.org/coopernurse/node-pool.png)](http://travis-ci.org/coopernurse/node-pool) | ||
If you are after the older version 2 of this library you should look at the [current github branch](https://github.com/coopernurse/node-pool/tree/v2.4) for it. | ||
If you are after the older version 2 of this library you should look at the [current github branch](https://github.com/coopernurse/node-pool/tree/v2.5) for it. | ||
@@ -79,3 +79,3 @@ | ||
// return object back to pool | ||
pool.release(client); | ||
myPool.release(client); | ||
}); | ||
@@ -93,4 +93,4 @@ }) | ||
// to shutdown and stop using this pool. | ||
pool.drain(function() { | ||
pool.clear(); | ||
myPool.drain(function() { | ||
myPool.clear(); | ||
}); | ||
@@ -143,4 +143,2 @@ | ||
- `testOnBorrow`: `boolean`: should the pool validate resources before giving them to clients. Requires that either `factory.validate` or `factory.validateAsync` to be specified | ||
- `idleTimeoutMillis`: max milliseconds a resource can stay unused in the pool without being borrowed before it should be destroyed (default 30000) | ||
- `reapIntervalMillis`: interval to check for idle resources (default 1000). (remove me!) | ||
- `acquireTimeoutMillis`: max milliseconds an `acquire` call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer. | ||
@@ -196,2 +194,6 @@ - `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) | ||
```js | ||
pool.destroy(resource) | ||
``` | ||
This function is for when you want to return a resource to the pool but want it destroyed rather than being made available to other resources. E.g you may know the resource has timed out or crashed. | ||
@@ -207,2 +209,12 @@ | ||
```js | ||
pool.on('factoryCreateError', function(err){ | ||
//log stuff maybe | ||
}) | ||
pool.on('factoryDestroyError', function(err){ | ||
//log stuff maybe | ||
}) | ||
``` | ||
The pool is an event emitter. Below are the events it emits and any args for those events | ||
@@ -222,21 +234,3 @@ | ||
## Draining | ||
If you are shutting down a long-lived process, you may notice | ||
that node fails to exit for 30 seconds or so. This is a side | ||
effect of the idleTimeoutMillis behavior -- the pool has a | ||
setTimeout() call registered that is in the event loop queue, so | ||
node won't terminate until all resources have timed out, and the pool | ||
stops trying to manage them. | ||
This behavior will be more problematic when you set factory.min > 0, | ||
as the pool will never become empty, and the setTimeout calls will | ||
never end. | ||
In these cases, use the pool.drain() function. This sets the pool | ||
into a "draining" state which will gracefully wait until all | ||
idle resources have timed out. For example, you can call: | ||
If you do this, your node process will exit gracefully. | ||
## Priority Queueing | ||
@@ -252,9 +246,9 @@ | ||
// borrowers can specify a priority 0 to 2 | ||
var opts = { | ||
const opts = { | ||
priorityRange : 3 | ||
} | ||
var pool = genericPool.createPool(someFactory,opts); | ||
const pool = genericPool.createPool(someFactory,opts); | ||
// acquire connection - no priority specified - will go onto lowest priority queue | ||
pool.acquire().thenfunction(client) { | ||
pool.acquire().then(function(client) { | ||
pool.release(client); | ||
@@ -261,0 +255,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
83495
358