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

3

CHANGELOG.md
# Change Log
## [2.4.3] - October 15 2016
- Use domain.bind to preserve domain context (@LewisJEllis)
## [2.4.2] - March 26 2016

@@ -4,0 +7,0 @@ - Travis now runs and fails lint checks (@kevinburke)

@@ -387,2 +387,5 @@ /**

}
if (process.domain) {
callback = process.domain.bind(callback)
}
this._waitingClients.enqueue(callback, priority)

@@ -389,0 +392,0 @@ this._dispense()

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

@@ -50,2 +50,6 @@ "contributors": [

"email": "james.butler@sandfox.co.uk"
},
{
"name": "Lewis J Ellis",
"email": "me@lewisjellis.com"
}

@@ -52,0 +56,0 @@ ],

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

})
},
'domain context is preserved on acquire callback': function (beforeExit) {
var assertion_count = 0
var pool = poolModule.Pool({
name: 'test',
create: function (cb) {
cb(null, {})
},
destroy: function (client) {},
max: 2,
idleTimeoutMillis: 1000
})
// bail on old node versions because domains didn't exist until v0.8
if (process.version < 'v0.8') {
return
}
var domain = require('domain')
function check (index) {
var wrapDomain = domain.create()
wrapDomain.index = index
wrapDomain.run(function () {
pool.acquire(function (err, client) {
assert.ifError(err)
assert.equal(domain.active.index, index)
assertion_count++
setTimeout(function () {
pool.release(client)
}, 50)
})
})
}
// first two will work even without domain binding
check(1)
check(2)
// third and on will fail without domain binding
check(3)
beforeExit(function () {
assert.equal(assertion_count, 3)
})
}
}
bugs/128.js
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