feat: refs #5846 Added eventScheduler function #4

Merged
guillermo merged 4 commits from 5846-eventScheduler into master 2024-03-21 06:46:25 +00:00
2 changed files with 11 additions and 1 deletions

View File

@ -156,7 +156,17 @@ class Push extends Command {
throw new Error(`Cannot obtain exclusive lock, used by connection ${isUsed}`); 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() { async function releaseLock() {
if (scheduler.state === 'ON') await eventScheduler(true);
await conn.query(`DO RELEASE_LOCK('myt_push')`); await conn.query(`DO RELEASE_LOCK('myt_push')`);
} }

View File

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