generic-pool
Advanced tools
Comparing version 2.0.4 to 2.1.0
@@ -97,2 +97,4 @@ var PriorityQueue = function(size) { | ||
* Should idle resources be destroyed and recreated every idleTimeoutMillis? Default: true. | ||
* @param {Bool} [factory.returnToHead=false] | ||
* Returns released object to head of available objects list | ||
* @returns {Object} An Object pool that works with the supplied `factory`. | ||
@@ -112,2 +114,3 @@ */ | ||
draining = false, | ||
returnToHead = factory.returnToHead || false, | ||
@@ -341,3 +344,8 @@ // Prepare a logger function. | ||
var objWithTimeout = { obj: obj, timeout: (new Date().getTime() + idleTimeoutMillis) }; | ||
availableObjects.push(objWithTimeout); | ||
if(returnToHead){ | ||
availableObjects.splice(0, 0, objWithTimeout); | ||
} | ||
else{ | ||
availableObjects.push(objWithTimeout); | ||
} | ||
log("timeout: " + objWithTimeout.timeout, 'verbose'); | ||
@@ -344,0 +352,0 @@ dispense(); |
{ | ||
"name": "generic-pool", | ||
"description": "Generic resource pooling for Node.JS", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"author": "James Cooper <james@bitmechanic.com>", | ||
@@ -11,3 +11,4 @@ "contributors": [ | ||
{ "name": "Tom MacWright", "url" : "http://www.developmentseed.org/" }, | ||
{ "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com", "url" : "http://somethingdoug.com/" } | ||
{ "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com", "url" : "http://somethingdoug.com/" }, | ||
{ "name": "calibr"} | ||
], | ||
@@ -26,3 +27,4 @@ "keywords": ["pool", "pooling", "throttle"], | ||
"test": "expresso -I lib test/*.js" | ||
} | ||
}, | ||
"license": "MIT" | ||
} |
@@ -23,2 +23,6 @@ [![build status](https://secure.travis-ci.org/coopernurse/node-pool.png)](http://travis-ci.org/coopernurse/node-pool) | ||
2.1.0 - June 19 2014 | ||
- Merged #72 - Add optional returnToHead flag, if true, resources are returned to head of queue (stack like | ||
behaviour) upon release (contributed by calibr), also see #68 for further discussion. | ||
2.0.4 - July 27 2013 | ||
@@ -195,2 +199,4 @@ - Merged #64 - Fix for not removing idle objects (contributed by PiotrWpl) | ||
reapIntervalMillis : frequency to check for idle resources (default 1000), | ||
returnToHead : boolean, if true 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. optional (default false) | ||
priorityRange : int between 1 and x - if set, borrowers can specify their | ||
@@ -326,3 +332,3 @@ relative priority in the queue if no resources are available. | ||
Copyright (c) 2010-2013 James Cooper <james@bitmechanic.com> | ||
Copyright (c) 2010-2014 James Cooper <james@bitmechanic.com> | ||
@@ -329,0 +335,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
0
350
49618
8
968
1