Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 2.4.1 to 2.4.2

9

bugs/128.js

@@ -25,3 +25,3 @@ var Pool = require('../').Pool;

function _validate(){callback(true)}
// Simulate this taking some time/event-loops
setTimeout(_validate, 10);

@@ -60,2 +60,8 @@ //setImmediate(_validate);

/**
*
* @param {string} work message to print when doing the work
* @param {integer|boolean} duration length of time the task should take to execute, or boolean for synchronous completion
* @return {function} [description]
*/
function createUnitOfWorkExecutor(work, duration){

@@ -78,2 +84,3 @@ return function(cb){

// Should probably use async for this....
setTimeout(unit1, 1000)

@@ -80,0 +87,0 @@ setTimeout(unit2, 2500)

# Change Log
## [2.4.2] - March 26 2016
- Travis now runs and fails lint checks (@kevinburke)
- fixed bug #128 where using async validation incorrectly tracked resource state (@johnjdooley and @robfyfe)
- fixed broken readme example that had aged badly
## [2.4.1] - February 20 2016

@@ -104,3 +109,4 @@ - Documented previously created/fixed bug #122 (thanks @jasonrhodes)

[unreleased]: https://github.com/coopernurse/node-pool/compare/v2.4.1...HEAD
[unreleased]: https://github.com/coopernurse/node-pool/compare/v2.4.2...HEAD
[2.4.2]: https://github.com/coopernurse/node-pool/compare/v2.4.1...v2.4.2
[2.4.1]: https://github.com/coopernurse/node-pool/compare/v2.4.0...v2.4.1

@@ -107,0 +113,0 @@ [2.4.0]: https://github.com/coopernurse/node-pool/compare/v2.3.1...v2.4.0

@@ -286,2 +286,3 @@ /**

self._availableObjects.shift()
self._inUseObjects.push(objWithTimeout.obj)
clientCb = self._waitingClients.dequeue()

@@ -288,0 +289,0 @@ clientCb(err, objWithTimeout.obj)

2

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

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

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

var Pool = require('generic-pool').Pool;
var mysql = require('mysql'); // v2.10.x
var pool = new Pool({
name : 'mysql',
create : function(callback) {
var Client = require('mysql').Client;
var c = new Client();
c.user = 'scott';
c.password = 'tiger';
c.database = 'mydb';
c.connect();
var c = mysql.createConnection({
user: 'scott',
password: 'tiger',
database:'mydb'
})
// parameter order: err, resource
// new in 1.0.6
callback(null, c);

@@ -38,0 +38,0 @@ },

@@ -113,3 +113,3 @@ var assert = require('assert')

pool.drain(function () {
pool.destroyAllNow();
pool.destroyAllNow()
})

@@ -705,3 +705,49 @@

})
},
'validate acquires object from the pool': function (beforeExit) {
var pool = poolModule.Pool({
name: 'test',
create: function (callback) {
process.nextTick(function () {
callback(null, { id: 'validId' })
})
},
validate: function (resource) {
return true
},
destroy: function (client) {},
max: 1,
idleTimeoutMillis: 100
})
pool.acquire(function (err, obj) {
assert.ifError(err)
assert.equal(pool.availableObjectsCount(), 0)
assert.equal(pool.inUseObjectsCount(), 1)
})
},
'validateAsync acquires object from the pool': function (beforeExit) {
var pool = poolModule.Pool({
name: 'test',
create: function (callback) {
process.nextTick(function () {
callback(null, { id: 'validId' })
})
},
validateAsync: function (resource, callback) {
callback(true)
},
destroy: function (client) {},
max: 1,
idleTimeoutMillis: 100
})
pool.acquire(function (err, obj) {
assert.ifError(err)
assert.equal(pool.availableObjectsCount(), 0)
assert.equal(pool.inUseObjectsCount(), 1)
})
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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