refs #5598 Push: DB ping interval added
This commit is contained in:
parent
fc68075240
commit
f003fa99de
12
myt-push.js
12
myt-push.js
|
@ -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();
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue