@ejfdelgado/ejflab-back 1.30.10 → 1.30.12

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.30.10",
3
+ "version": "1.30.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ejfdelgado/ejflab-back.git"
@@ -45,7 +45,7 @@ export class PostgresSrv {
45
45
  return val.replace(/'/g, "''");
46
46
  }
47
47
  static singleWord(val, ...args) {
48
- const text = PostgresSrv.sanitizeTextNull(text);
48
+ const text = PostgresSrv.sanitizeTextNull(val);
49
49
  return text.split(/\s+/g)[0];
50
50
  }
51
51
  static sanitizeText(val, ...args) {
@@ -147,6 +147,16 @@ export class PostgresSrv {
147
147
  database: params.database,
148
148
  connectionTimeoutMillis: parseInt(params.timeout),
149
149
  });
150
+ PostgresSrv.pool.on('error', (err) => {
151
+ // try reconnect given the tipe of error
152
+ console.log("-------------------------------------");
153
+ console.log("------------------ Handling error ---");
154
+ console.log("-------------------------------------");
155
+ console.log(JSON.stringify(err.message));
156
+ if (err.message == "read ETIMEDOUT") {
157
+ PostgresSrv.createPool();
158
+ }
159
+ });
150
160
  }
151
161
 
152
162
  static async checkSelect1() {