@trenskow/pged 5.1.70 → 5.1.72
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/index.js +8 -0
- package/package.json +2 -1
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import Puqeue from 'puqeue';
|
|
|
10
10
|
import caseit from '@trenskow/caseit';
|
|
11
11
|
import pg from 'pg';
|
|
12
12
|
import EventEmitter from '@trenskow/async-event-emitter';
|
|
13
|
+
import wait from '@trenskow/wait';
|
|
13
14
|
|
|
14
15
|
import QueryBuilder from './query-builder.js';
|
|
15
16
|
|
|
@@ -44,7 +45,10 @@ export default class PGed extends EventEmitter {
|
|
|
44
45
|
options.casing = options.casing || {};
|
|
45
46
|
options.casing.db = options.casing.db || 'snake';
|
|
46
47
|
options.casing.js = options.casing.hs || 'camel';
|
|
48
|
+
|
|
49
|
+
options.connection = options.connection || {};
|
|
47
50
|
options.connectionRetryCount = options.connectionRetryCount || 1;
|
|
51
|
+
options.connectionRetryDelay = options.connectionRetryDelay || '0s';
|
|
48
52
|
|
|
49
53
|
options.defaultPrimaryKey = options.defaultPrimaryKey || 'id';
|
|
50
54
|
|
|
@@ -123,9 +127,13 @@ export default class PGed extends EventEmitter {
|
|
|
123
127
|
this._client = await pool.connect();
|
|
124
128
|
break;
|
|
125
129
|
} catch (error) {
|
|
130
|
+
|
|
126
131
|
if (connectionCount == this._options.connectionRetryCount) {
|
|
127
132
|
throw error;
|
|
128
133
|
}
|
|
134
|
+
|
|
135
|
+
await wait(this._options.connectionRetryDelay);
|
|
136
|
+
|
|
129
137
|
}
|
|
130
138
|
}
|
|
131
139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trenskow/pged",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.72",
|
|
4
4
|
"description": "Just a silly little db management and query builder for PostgreSQL.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@trenskow/caseit": "^1.4.12",
|
|
28
28
|
"@trenskow/custom-promise": "^0.13.9",
|
|
29
29
|
"@trenskow/parse": "^0.1.33",
|
|
30
|
+
"@trenskow/wait": "^1.3.60",
|
|
30
31
|
"pg": "^8.16.0",
|
|
31
32
|
"puqeue": "^1.1.17"
|
|
32
33
|
},
|