@ejfdelgado/ejflab-back 1.29.0 → 1.30.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.
- package/package.json +1 -1
- package/srv/PostgresSrv.mjs +9 -2
package/package.json
CHANGED
package/srv/PostgresSrv.mjs
CHANGED
@@ -142,14 +142,21 @@ export class PostgresSrv {
|
|
142
142
|
});
|
143
143
|
}
|
144
144
|
|
145
|
-
static async
|
145
|
+
static async checkSelect1() {
|
146
146
|
if (PostgresSrv.pool == null) {
|
147
147
|
PostgresSrv.createPool();
|
148
148
|
}
|
149
149
|
try {
|
150
150
|
await PostgresSrv.pool.query('SELECT 1;');
|
151
|
+
return true;
|
151
152
|
} catch (err) {
|
152
|
-
|
153
|
+
return false;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
static async getPool() {
|
158
|
+
const canSelect1 = await PostgresSrv.checkSelect1();
|
159
|
+
if (!canSelect1) {
|
153
160
|
PostgresSrv.createPool();
|
154
161
|
}
|
155
162
|
return PostgresSrv.pool;
|