diff --git a/myt-push.js b/myt-push.js index 970fc7b..041baf7 100644 --- a/myt-push.js +++ b/myt-push.js @@ -156,7 +156,17 @@ class Push extends Command { throw new Error(`Cannot obtain exclusive lock, used by connection ${isUsed}`); } + const [[scheduler]] = await conn.query(`SELECT @@event_scheduler state`); + if (scheduler.state === 'ON') await eventScheduler(false); + + async function eventScheduler(isActive) { + await conn.query( + `SET GLOBAL event_scheduler = ${isActive ? 'ON' : 'OFF'}` + ); + } + async function releaseLock() { + if (scheduler.state === 'ON') await eventScheduler(true); await conn.query(`DO RELEASE_LOCK('myt_push')`); } diff --git a/package.json b/package.json index ff7d358..8171d65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@verdnatura/myt", - "version": "1.6.8", + "version": "1.6.9", "author": "Verdnatura Levante SL", "description": "MySQL version control", "license": "GPL-3.0",