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

apool

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apool - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

5

History.md
0.1.1 / 2013-12-31
==================
* fix item timeout
0.1.0 / 2013-12-31

@@ -3,0 +8,0 @@ ==================

17

lib/index.js

@@ -155,13 +155,5 @@

debug('timeout in %d', ms);
tid = setTimeout(function(){
clearTimeout(tid);
debug('timeout');
fn();
}, ms);
if (this.items.length) {
obj = this.items.pop();
return setImmediate(function(){
clearTimeout(tid);
fn(null, obj);

@@ -173,5 +165,13 @@ debug('acquired, total items: %d', self.items.length);

debug('timeout in %d', ms);
tid = setTimeout(function(){
clearTimeout(tid);
debug('timeout');
fn();
}, ms);
if (this._constructor) {
return this.generate(function(err, item){
if (err) return fn(err);
if (item) clearTimeout(tid);
if (item) return self.acquire(fn);

@@ -275,3 +275,4 @@ self.once('return', function(){

if (fn) fn(obj);
--this.added;
return this;
};

@@ -5,3 +5,3 @@ {

"repo": "yields/apool",
"version": "0.1.0",
"version": "0.1.1",
"dependencies": {

@@ -8,0 +8,0 @@ "debug": "~0.7.4",

@@ -127,2 +127,20 @@

describe('destruct()', function(){
it('should call destructor', function(){
var p = pool();
var obj = {};
p.destructor(function(obj){ obj.called = true; });
p.destruct(obj);
obj.called.should.be.true;
})
it('should decrement added', function(){
var p = pool();
p.destructor(function(){});
p.added.should.eql(0);
p.destruct({});
p.added.should.eql(-1);
})
})
describe('return()', function(){

@@ -129,0 +147,0 @@ it('should return an item to items', function(){

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