Skip to content

Commit

Permalink
make useCount safe
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Mar 12, 2021
1 parent 8438736 commit 7848329
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function poolConnect(ctx, db, config) {
reject(err);
} else {
if (`$useCount` in client) {
client.$useCount++;
client.$useCount = client.$useCount >= Number.MAX_SAFE_INTEGER ? 0 : ++client.$useCount;
} else {
Object.defineProperty(client, `$useCount`, {
value: 0,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pg-promise",
"version": "10.9.4",
"version": "10.9.5",
"description": "PostgreSQL interface for Node.js",
"main": "lib/index.js",
"typings": "typescript/pg-promise.d.ts",
Expand Down Expand Up @@ -46,7 +46,7 @@
"spex": "3.2.0"
},
"devDependencies": {
"@types/node": "14.14.31",
"@types/node": "14.14.33",
"bluebird": "3.7.2",
"coveralls": "3.1.0",
"eslint": "7.21.0",
Expand All @@ -56,6 +56,6 @@
"JSONStream": "1.3.5",
"pg-query-stream": "4.0.0",
"tslint": "6.1.3",
"typescript": "4.2.2"
"typescript": "4.2.3"
}
}

0 comments on commit 7848329

Please sign in to comment.