refs #5598 Push: DB ping interval added

This commit is contained in:
Juan Ferrer 2023-04-25 17:06:57 +02:00
parent fc68075240
commit f003fa99de
3 changed files with 12 additions and 6 deletions

View File

@ -49,6 +49,12 @@ class Push extends Command {
const [[row]] = await conn.query( const [[row]] = await conn.query(
`SELECT GET_LOCK('myt_push', 30) getLock`); `SELECT GET_LOCK('myt_push', 30) getLock`);
const pingTimeout = setInterval(async() => {
try {
await conn.ping()
} catch (e) {}
}, 60 * 1000);
if (!row.getLock) { if (!row.getLock) {
let isUsed = 0; let isUsed = 0;
@ -70,10 +76,10 @@ class Push extends Command {
} catch(err) { } catch(err) {
try { try {
await releaseLock(); await releaseLock();
} catch (e) { } catch (e) {}
console.error(e);
}
throw err; throw err;
} finally {
clearInterval(pingTimeout);
} }
await releaseLock(); await releaseLock();

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@verdnatura/myt", "name": "@verdnatura/myt",
"version": "1.5.17", "version": "1.5.18",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@verdnatura/myt", "name": "@verdnatura/myt",
"version": "1.5.17", "version": "1.5.18",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@sqltools/formatter": "^1.2.5", "@sqltools/formatter": "^1.2.5",

View File

@ -1,6 +1,6 @@
{ {
"name": "@verdnatura/myt", "name": "@verdnatura/myt",
"version": "1.5.17", "version": "1.5.18",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "MySQL version control", "description": "MySQL version control",
"license": "GPL-3.0", "license": "GPL-3.0",