@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-back",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ejfdelgado/ejflab-back.git"
@@ -142,14 +142,21 @@ export class PostgresSrv {
142
142
  });
143
143
  }
144
144
 
145
- static async getPool() {
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
- console.log(err);
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;