New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lightning-pool

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightning-pool - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

22

dist/Pool.d.ts

@@ -55,6 +55,8 @@ /// <reference types="node" />

*/
close(): Promise<void>;
close(callback: Callback): void;
close(terminateWait: number, callback?: Callback): Promise<void>;
close(callback?: Callback): void;
close(terminateWait: number, callback?: Callback): void;
close(force: boolean, callback?: Callback): void;
closeAsync(): Promise<void>;
closeAsync(terminateWait: number): Promise<void>;
closeAsync(force: boolean): Promise<void>;
/**

@@ -68,10 +70,16 @@ * Acquires `resource` from the pool or create a new one

*/
release(resource: T): Promise<void>;
release(resource: T, callback: Callback): void;
release(resource: T, callback?: Callback): any;
/**
* Async version of release().
*/
releaseAsync(resource: T): Promise<void>;
/**
* Releases, destroys and removes any `resource` from `Pool`.
*/
destroy(resource: T): Promise<void>;
destroy(resource: T, callback: Callback): void;
destroy(resource: T, callback?: Callback): any;
/**
* Async version of destroy().
*/
destroyAsync(resource: T): Promise<void>;
/**
* Returns if a `resource` has been acquired from the pool and not yet released or destroyed.

@@ -78,0 +86,0 @@ */

@@ -129,3 +129,3 @@ "use strict";

if (terminateWait <= 0) {
this._acquiredResources.forEach(t => this.destroy(t.resource, () => 0));
this._acquiredResources.forEach(t => this.destroy(t.resource));
}

@@ -151,2 +151,5 @@ else {

}
closeAsync(arg0) {
return putil_promisify_1.default.fromCallback(cb => this.close(arg0, cb));
}
acquire(arg0) {

@@ -167,5 +170,6 @@ if (!arg0)

}
/**
* Releases an allocated `resource` and let it back to pool.
*/
release(resource, callback) {
if (!callback)
return putil_promisify_1.default.fromCallback(cb => this.release(resource, cb));
const item = this._allResources.get(resource);

@@ -176,5 +180,12 @@ if (item && item.state !== definitions_1.ResourceState.IDLE)

}
/**
* Async version of release().
*/
releaseAsync(resource) {
return putil_promisify_1.default.fromCallback(cb => this.release(resource, cb));
}
/**
* Releases, destroys and removes any `resource` from `Pool`.
*/
destroy(resource, callback) {
if (!callback)
return putil_promisify_1.default.fromCallback(cb => this.destroy(resource, cb));
try {

@@ -185,3 +196,3 @@ const item = this._allResources.get(resource);

else
callback();
callback && callback();
}

@@ -193,2 +204,8 @@ finally {

/**
* Async version of destroy().
*/
destroyAsync(resource) {
return putil_promisify_1.default.fromCallback(cb => this.destroy(resource, cb));
}
/**
* Returns if a `resource` has been acquired from the pool and not yet released or destroyed.

@@ -420,3 +437,2 @@ */

const handleCallback = (err) => {
this._allResources.delete(item.resource);
if (err) {

@@ -432,2 +448,4 @@ this.emit('destroy-error', err, item.resource);

try {
this._allResources.delete(item.resource);
this._processNextRequest();
const o = this._factory.destroy(item.resource);

@@ -434,0 +452,0 @@ putil_promisify_1.default.await(o, handleCallback);

{
"name": "lightning-pool",
"description": "Fastest generic Pool written with TypeScript",
"version": "3.0.1",
"version": "3.1.0",
"author": "Panates Ltd.",

@@ -22,9 +22,9 @@ "contributors": [

"devDependencies": {
"@types/mocha": "^8.0.4",
"@types/node": "^14.14.7",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"@types/mocha": "^8.2.0",
"@types/node": "^14.14.11",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"@typescript-eslint/parser": "^4.9.1",
"babel-eslint": "^10.1.0",
"dotenv": "^8.2.0",
"eslint": "^7.13.0",
"eslint": "^7.15.0",
"eslint-config-google": "^0.14.0",

@@ -36,6 +36,6 @@ "mocha": "^8.2.1",

"ts-loader": "^8.0.11",
"ts-node": "^9.0.0",
"ts-mocha": "^8.0.0",
"ts-node": "^9.1.1",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.0.5"
"typescript": "^4.1.2"
},

@@ -42,0 +42,0 @@ "engines": {

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