@contember/database
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -118,2 +118,3 @@ /// <reference types="node" /> | ||
private handleAvailableConnection; | ||
private removeIdleConnection; | ||
private disposeConnection; | ||
@@ -120,0 +121,0 @@ private log; |
@@ -214,2 +214,7 @@ "use strict"; | ||
this.poolConfig.logError(new errors_1.ClientError(e, 'runtime error')); | ||
this.poolStats.connection_error_count++; | ||
if (!this.active.has(poolConnection)) { | ||
this.removeIdleConnection(poolConnection); | ||
this.disposeConnection(poolConnection); | ||
} | ||
}); | ||
@@ -345,5 +350,3 @@ try { | ||
poolConnection.timerId = setTimeout(async () => { | ||
const index = this.idle.indexOf(poolConnection); | ||
if (index > -1) { | ||
this.idle.splice(index, 1); | ||
if (this.removeIdleConnection(poolConnection)) { | ||
await this.disposeConnection(poolConnection); | ||
@@ -358,2 +361,10 @@ this.poolStats.connection_disposed_idle_timeout_count++; | ||
} | ||
removeIdleConnection(poolConnection) { | ||
const index = this.idle.indexOf(poolConnection); | ||
if (index > -1) { | ||
this.idle.splice(index, 1); | ||
return true; | ||
} | ||
return false; | ||
} | ||
async disposeConnection(connection) { | ||
@@ -360,0 +371,0 @@ try { |
{ | ||
"name": "@contember/database", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"license": "Apache-2.0", | ||
@@ -11,6 +11,6 @@ "main": "dist/src/index.js", | ||
"dependencies": { | ||
"@contember/queryable": "^1.2.0" | ||
"@contember/queryable": "^1.2.1" | ||
}, | ||
"devDependencies": { | ||
"@contember/database-tester": "^1.2.0", | ||
"@contember/database-tester": "^1.2.1", | ||
"@types/node": "^18", | ||
@@ -17,0 +17,0 @@ "pg": "^8.9.0" |
@@ -309,2 +309,8 @@ import { ImplementationException } from '../exceptions' | ||
this.poolConfig.logError(new ClientError(e, 'runtime error')) | ||
this.poolStats.connection_error_count++ | ||
if (!this.active.has(poolConnection)) { | ||
this.removeIdleConnection(poolConnection) | ||
this.disposeConnection(poolConnection) | ||
} | ||
}) | ||
@@ -414,3 +420,2 @@ try { | ||
private handleAvailableConnection(poolConnection: PoolConnection) { | ||
@@ -442,5 +447,3 @@ const item = this.queue.shift() | ||
poolConnection.timerId = setTimeout(async () => { | ||
const index = this.idle.indexOf(poolConnection) | ||
if (index > -1) { | ||
this.idle.splice(index, 1) | ||
if (this.removeIdleConnection(poolConnection)) { | ||
await this.disposeConnection(poolConnection) | ||
@@ -456,2 +459,12 @@ this.poolStats.connection_disposed_idle_timeout_count++ | ||
private removeIdleConnection(poolConnection: PoolConnection) { | ||
const index = this.idle.indexOf(poolConnection) | ||
if (index > -1) { | ||
this.idle.splice(index, 1) | ||
return true | ||
} | ||
return false | ||
} | ||
private async disposeConnection(connection: PoolConnection) { | ||
@@ -458,0 +471,0 @@ try { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
612836
8954
Updated@contember/queryable@^1.2.1