dt-common-device 13.8.8 → 13.9.0

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.
Files changed (2) hide show
  1. package/dist/db/db.js +28 -28
  2. package/package.json +1 -1
package/dist/db/db.js CHANGED
@@ -11,45 +11,45 @@ exports.getWebhookPostgresClient = getWebhookPostgresClient;
11
11
  const pg_1 = require("pg");
12
12
  const config_1 = require("../config/config");
13
13
  const mongoose_1 = __importDefault(require("mongoose"));
14
+ let adminPool = null;
15
+ let accessPool = null;
16
+ let pmsPool = null;
17
+ let webhookPool = null;
14
18
  function getPostgresClient() {
15
19
  const URI = (0, config_1.getAdminPostgresDbUri)();
16
- let pool = null;
17
- if (!pool) {
18
- pool = new pg_1.Pool({
19
- connectionString: URI,
20
- });
21
- }
22
- return pool;
20
+ adminPool ?? (adminPool = new pg_1.Pool({
21
+ connectionString: URI,
22
+ connectionTimeoutMillis: 5000,
23
+ idleTimeoutMillis: 30000,
24
+ }));
25
+ return adminPool;
23
26
  }
24
27
  function getAccessPostgresClient() {
25
28
  const URI = (0, config_1.getAccessPostgresDbUri)();
26
- let pool = null;
27
- if (!pool) {
28
- pool = new pg_1.Pool({
29
- connectionString: URI,
30
- });
31
- }
32
- return pool;
29
+ accessPool ?? (accessPool = new pg_1.Pool({
30
+ connectionString: URI,
31
+ connectionTimeoutMillis: 5000,
32
+ idleTimeoutMillis: 30000,
33
+ }));
34
+ return accessPool;
33
35
  }
34
36
  function getPmsPostgresClient() {
35
37
  const URI = (0, config_1.getPmsPostgresDbUri)();
36
- let pool = null;
37
- if (!pool) {
38
- pool = new pg_1.Pool({
39
- connectionString: URI,
40
- });
41
- }
42
- return pool;
38
+ pmsPool ?? (pmsPool = new pg_1.Pool({
39
+ connectionString: URI,
40
+ connectionTimeoutMillis: 5000,
41
+ idleTimeoutMillis: 30000,
42
+ }));
43
+ return pmsPool;
43
44
  }
44
45
  function getWebhookPostgresClient() {
45
46
  const URI = (0, config_1.getWebhookPostgresDbUri)();
46
- let pool = null;
47
- if (!pool) {
48
- pool = new pg_1.Pool({
49
- connectionString: URI,
50
- });
51
- }
52
- return pool;
47
+ webhookPool ?? (webhookPool = new pg_1.Pool({
48
+ connectionString: URI,
49
+ connectionTimeoutMillis: 5000,
50
+ idleTimeoutMillis: 30000,
51
+ }));
52
+ return webhookPool;
53
53
  }
54
54
  const connectDatabase = async () => {
55
55
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "13.8.8",
3
+ "version": "13.9.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [