sequelize-pool
Advanced tools
Comparing version
@@ -6,2 +6,3 @@ "use strict"; | ||
const AggregateError_1 = require("./AggregateError"); | ||
const defaultTo_1 = require("./helpers/defaultTo"); | ||
class Pool { | ||
@@ -36,7 +37,7 @@ constructor(factory) { | ||
} | ||
this.idleTimeoutMillis = factory.idleTimeoutMillis || 30000; | ||
this.acquireTimeoutMillis = factory.acquireTimeoutMillis || 30000; | ||
this.reapIntervalMillis = factory.reapIntervalMillis || 1000; | ||
this.maxUsesPerResource = factory.maxUses || Infinity; | ||
this.log = factory.log || false; | ||
this.idleTimeoutMillis = (0, defaultTo_1.defaultTo)(factory.idleTimeoutMillis, 30000); | ||
this.acquireTimeoutMillis = (0, defaultTo_1.defaultTo)(factory.acquireTimeoutMillis, 30000); | ||
this.reapIntervalMillis = (0, defaultTo_1.defaultTo)(factory.reapIntervalMillis, 1000); | ||
this.maxUsesPerResource = (0, defaultTo_1.defaultTo)(factory.maxUses, Infinity); | ||
this.log = (0, defaultTo_1.defaultTo)(factory.log, false); | ||
this._factory = factory; | ||
@@ -121,3 +122,4 @@ this._count = 0; | ||
this._log('dispense() - reusing obj', 'verbose'); | ||
wrappedResource = this._availableObjects[this._availableObjects.length - 1]; | ||
wrappedResource = | ||
this._availableObjects[this._availableObjects.length - 1]; | ||
if (!this._factory.validate(wrappedResource.resource)) { | ||
@@ -124,0 +126,0 @@ this.destroy(wrappedResource.resource); |
{ | ||
"name": "sequelize-pool", | ||
"description": "Resource pooling for Node.JS", | ||
"version": "7.1.0", | ||
"version": "8.0.0", | ||
"author": "Sushant <sushantdhiman@outlook.com>", | ||
@@ -24,13 +24,13 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/node": "^10.17.54", | ||
"@typescript-eslint/eslint-plugin": "^4.0.0", | ||
"@typescript-eslint/parser": "^4.0.0", | ||
"eslint": "^7.0.0", | ||
"eslint-config-prettier": "^7.0.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"prettier": "^2.0.2", | ||
"tap": "^14.10.7", | ||
"typedoc": "^0.20.30", | ||
"typedoc-plugin-markdown": "^3.6.0", | ||
"typescript": "~4.2.2" | ||
"@types/node": "^10.17.60", | ||
"@typescript-eslint/eslint-plugin": "^5.30.7", | ||
"@typescript-eslint/parser": "^5.30.7", | ||
"eslint": "^8.20.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"prettier": "^2.7.1", | ||
"tap": "^16.3.0", | ||
"typedoc": "^0.23.9", | ||
"typedoc-plugin-markdown": "^3.13.4", | ||
"typescript": "^4.7.0" | ||
}, | ||
@@ -44,3 +44,3 @@ "engines": { | ||
"lint": "eslint --ext .js,.ts src/**/* test/**/*", | ||
"pretty": "prettier src/**/*.ts test/**/*.js --write", | ||
"pretty": "prettier src test --write", | ||
"docs": "typedoc", | ||
@@ -52,3 +52,6 @@ "test:raw": "tap test/**/*-test.js" | ||
}, | ||
"tap": { | ||
"check-coverage": false | ||
}, | ||
"license": "MIT" | ||
} |
export { TimeoutError } from './TimeoutError'; | ||
export { AggregateError } from './AggregateError'; | ||
export { Pool, FactoryOptions } from './Pool'; | ||
export { Pool, FactoryOptions, LogLevel, FactoryLogger } from './Pool'; |
/// <reference types="node" /> | ||
import { Deferred } from './Deferred'; | ||
declare type LogLevel = 'verbose' | 'info' | 'error'; | ||
declare type FactoryLogger = (message: string, level: LogLevel) => void; | ||
export declare type LogLevel = 'verbose' | 'info' | 'error'; | ||
export declare type FactoryLogger = (message: string, level: LogLevel) => void; | ||
declare type PooledObject<T> = { | ||
@@ -6,0 +6,0 @@ resource: T; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38067
1.61%21
10.53%459
2.23%