@trenskow/pged 5.1.72 → 5.1.74
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 +6 -5
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -47,8 +47,9 @@ export default class PGed extends EventEmitter {
|
|
|
47
47
|
options.casing.js = options.casing.hs || 'camel';
|
|
48
48
|
|
|
49
49
|
options.connection = options.connection || {};
|
|
50
|
-
options.
|
|
51
|
-
options.
|
|
50
|
+
options.connection.retry = options.connection.retry || {};
|
|
51
|
+
options.connection.retry.count = options.connection.retry.count || 1;
|
|
52
|
+
options.connection.retry.delay = options.connection.retry.delay || '0s';
|
|
52
53
|
|
|
53
54
|
options.defaultPrimaryKey = options.defaultPrimaryKey || 'id';
|
|
54
55
|
|
|
@@ -121,18 +122,18 @@ export default class PGed extends EventEmitter {
|
|
|
121
122
|
|
|
122
123
|
let connectionCount = 0;
|
|
123
124
|
|
|
124
|
-
while (connectionCount < this._options.
|
|
125
|
+
while (connectionCount < this._options.connection.retry.count) {
|
|
125
126
|
try {
|
|
126
127
|
connectionCount++;
|
|
127
128
|
this._client = await pool.connect();
|
|
128
129
|
break;
|
|
129
130
|
} catch (error) {
|
|
130
131
|
|
|
131
|
-
if (connectionCount == this._options.
|
|
132
|
+
if (connectionCount == this._options.connection.retry.count) {
|
|
132
133
|
throw error;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
await wait(this._options.
|
|
136
|
+
await wait(this._options.connection.retry.delay);
|
|
136
137
|
|
|
137
138
|
}
|
|
138
139
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trenskow/pged",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.74",
|
|
4
4
|
"description": "Just a silly little db management and query builder for PostgreSQL.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"@trenskow/async-event-emitter": "^0.1.67",
|
|
27
27
|
"@trenskow/caseit": "^1.4.12",
|
|
28
28
|
"@trenskow/custom-promise": "^0.13.9",
|
|
29
|
-
"@trenskow/parse": "^0.1.
|
|
30
|
-
"@trenskow/wait": "^1.3.
|
|
29
|
+
"@trenskow/parse": "^0.1.34",
|
|
30
|
+
"@trenskow/wait": "^1.3.61",
|
|
31
31
|
"pg": "^8.16.0",
|
|
32
32
|
"puqeue": "^1.1.17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/eslintrc": "^3.3.1",
|
|
36
36
|
"@eslint/js": "^9.13.0",
|
|
37
|
-
"eslint": "^9.
|
|
38
|
-
"globals": "^16.
|
|
37
|
+
"eslint": "^9.28.0",
|
|
38
|
+
"globals": "^16.2.0"
|
|
39
39
|
}
|
|
40
40
|
}
|