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}`);
}
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')`);
}
guillermo marked this conversation as resolved Outdated
Outdated
Review

Mover antes del RELEASE_LOCK

Mover antes del RELEASE_LOCK

View File

@ -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",