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 3.0.0-alpha.5 to 3.0.0-alpha.6

28

lib/Pool.js

@@ -42,2 +42,3 @@ 'use strict'

// TODO: fix up this ugly glue-ing
this._Promise = this._config.Promise

@@ -117,6 +118,7 @@

// NOTE: this maybe very bad promise usage?
const destroyOp = this._factory.destroy(pooledResource.obj)
this._factoryDestroyOperations.add(destroyOp)
const destroyPromise = this._factory.destroy(pooledResource.obj)
const wrappedDestroyPromise = this._Promise.resolve(destroyPromise)
this._factoryDestroyOperations.add(wrappedDestroyPromise)
destroyOp
wrappedDestroyPromise
.catch((reason) => {

@@ -126,3 +128,3 @@ this.emit(FACTORY_DESTROY_ERROR, reason)

.then(() => {
this._factoryDestroyOperations.delete(destroyOp)
this._factoryDestroyOperations.delete(wrappedDestroyPromise)
})

@@ -191,7 +193,8 @@

this._testOnBorrowResources.add(pooledResource)
const validationOp = this._factory.validate(pooledResource.obj)
this._validationOperations.add(validationOp)
const validationPromise = this._factory.validate(pooledResource.obj)
const wrappedValidationPromise = this._Promise.resolve(validationPromise)
this._validationOperations.add(wrappedValidationPromise)
validationOp.then((isValid) => {
this._validationOperations.delete(validationOp)
wrappedValidationPromise.then((isValid) => {
this._validationOperations.delete(wrappedValidationPromise)
this._testOnBorrowResources.delete(pooledResource)

@@ -330,11 +333,12 @@

const factoryPromise = this._factory.create()
this._factoryCreateOperations.add(factoryPromise)
const wrappedFactoryPromise = this._Promise.resolve(factoryPromise)
this._factoryCreateOperations.add(wrappedFactoryPromise)
factoryPromise
wrappedFactoryPromise
.then((resource) => {
this._factoryCreateOperations.delete(factoryPromise)
this._factoryCreateOperations.delete(wrappedFactoryPromise)
this._handleNewResource(resource)
})
.catch((reason) => {
this._factoryCreateOperations.delete(factoryPromise)
this._factoryCreateOperations.delete(wrappedFactoryPromise)
this.emit(FACTORY_CREATE_ERROR, reason)

@@ -341,0 +345,0 @@ this._dispense()

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

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

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

_Note: The values returned from `create`, `destroy`, and `validate` are all wrapped in a `Promise.resolve` by the pool before being used internally._

@@ -127,0 +128,0 @@ **opts**

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