zet-lib 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/connection.js +14 -3
- package/package.json +3 -2
package/lib/connection.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
const { Pool } = require('
|
|
1
|
+
const { Pool } = require('postgres-pool')
|
|
2
2
|
const config = require('dotenv').config()
|
|
3
3
|
const Util = require('./Util')
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const configPG = {
|
|
6
6
|
user: process.env.PGUSER,
|
|
7
7
|
host: process.env.PGHOST,
|
|
8
8
|
database: process.env.PGDATABASE,
|
|
9
9
|
password: process.env.PGPASSWORD,
|
|
10
|
-
port: process.env.PGPORT
|
|
10
|
+
port: process.env.PGPORT,
|
|
11
|
+
max: 20, // set pool max size to 20
|
|
12
|
+
idleTimeoutMillis: 1000, // close idle clients after 1 second
|
|
13
|
+
connectionTimeoutMillis: 10000, // return an error after 10 second if connection could not be established
|
|
14
|
+
maxUses: 7500, // close (and replace) a connection after it has been used 7500 times (see below for discussion)
|
|
15
|
+
poolSize: 50, // Default is 10 connections
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const pool = new Pool(configPG)
|
|
19
|
+
|
|
20
|
+
pool.on('error', (err) => {
|
|
21
|
+
console.error('Unexpected error on idle client', err)
|
|
11
22
|
})
|
|
12
23
|
|
|
13
24
|
const connection = {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zet-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.22",
|
|
4
4
|
"description": "zet is a library that part of zet generator.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"nodemailer": "^6.9.4",
|
|
42
42
|
"pg": "^8.11.2",
|
|
43
43
|
"pm2": "^5.3.0",
|
|
44
|
+
"postgres-pool": "^8.1.4",
|
|
44
45
|
"puppeteer": "^21.0.1",
|
|
45
46
|
"qs": "^6.11.2",
|
|
46
47
|
"randomstring": "^1.3.0",
|
|
@@ -49,4 +50,4 @@
|
|
|
49
50
|
"uuid": "^9.0.0",
|
|
50
51
|
"xlsx": "^0.18.5"
|
|
51
52
|
}
|
|
52
|
-
}
|
|
53
|
+
}
|