Socket
Socket
Sign inDemoInstall

tarn

Package Overview
Dependencies
0
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.1 to 3.0.2

0

dist/PendingOperation.d.ts

@@ -0,0 +0,0 @@ import { Deferred } from './utils';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

24

dist/Pool.js

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

try {
if (validationSuccess) {
if (validationSuccess && !pendingAcquire.isRejected) {
// At least one active resource exist, start reaping.

@@ -305,3 +305,16 @@ this._startReaping();

remove(this.used, free);
this._destroy(free.resource);
// Only destroy the resource if the validation has failed
if (!validationSuccess) {
this._destroy(free.resource);
// Since we destroyed an invalid resource and were not able to fulfill
// all the pending acquires, we may need to create new ones or at
// least run this acquire loop again to verify it. But not immediately
// to prevent starving event loop.
setTimeout(() => {
this._tryAcquireOrCreate();
}, 0);
}
else {
this.free.push(free);
}
// is acquire was canceled, failed or timed out already

@@ -312,9 +325,2 @@ // no need to return it to pending queries

}
// Since we destroyed an invalid resource and were not able to fulfill
// all the pending acquires, we may need to create new ones or at
// least run this acquire loop again to verify it. But not immediately
// to prevent starving event loop.
setTimeout(() => {
this._tryAcquireOrCreate();
}, 0);
}

@@ -321,0 +327,0 @@ }

@@ -0,0 +0,0 @@ export declare type PromiseInspectionArgs<T> = {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Deferred } from './utils';

@@ -0,0 +0,0 @@ "use strict";

import { Pool } from './Pool';
import { TimeoutError } from './TimeoutError';
export { Pool, TimeoutError };

@@ -0,0 +0,0 @@ "use strict";

export declare class TimeoutError extends Error {
}

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { PromiseInspection } from './PromiseInspection';

@@ -0,0 +0,0 @@ "use strict";

{
"name": "tarn",
"version": "3.0.1",
"version": "3.0.2",
"description": "Simple and robust resource pool for node.js",

@@ -5,0 +5,0 @@ "main": "dist/tarn.js",

@@ -31,5 +31,5 @@ [![Build Status](https://travis-ci.org/Vincit/tarn.js.svg?branch=master)](https://travis-ci.org/Vincit/tarn.js)

// Validates a connection before it is used. Return true or false
// from it. If false is returned, the resource is destroyed and a
// from it. If false is returned, the resource is destroyed and
// another one is acquired. Should return a Promise if validate is
// async function.
// an async function.
validate: resource => {

@@ -39,4 +39,4 @@ return true;

// Function that destroys a resource, should return promise if
// destroying is asynchronous operation.
// Function that destroys a resource, should return a promise if
// destroying is an asynchronous operation.
destroy: someResource => {

@@ -88,7 +88,7 @@ someResource.cleanup();

// acquire can be aborted using the abort method.
// If acquire had triggered creating new resource to the pool
// If acquire had triggered creating a new resource in the pool
// creation will continue and it is not aborted.
acquire.abort();
// the acquire object has a promise property that gets reolved with
// the acquire object has a promise property that gets resolved with
// the acquired resource

@@ -123,5 +123,5 @@ try {

// The following examples add synchronous event handlers for example to
// allow externally collect diagnostic data of pool behaviour.
// If any of these hooks fail, all errors are catched and warnings are logged.
// The following examples add synchronous event handlers. For example, to
// allow externally collecting pool behaviour diagnostic data.
// If any of these hooks fail, all errors are caught and warnings are logged.

@@ -166,2 +166,6 @@ // resource is acquired from pool

### 3.0.2 2021-11-29
- Valid resources with rejected acquires are returned to the pool #68
### 3.0.1 2020-10-25

@@ -176,3 +180,3 @@

Released as major version, because async validation support did require lots of internal changes, which may cause sutil difference in behavior.
Released as major version, because async validation support did require lots of internal changes, which may cause subtle difference in behavior.

@@ -179,0 +183,0 @@ ### 2.0.0 2019-06-02

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc