Merge pull request 'feat: refs #5846 Added eventScheduler function' (!4) from 5846-eventScheduler into master

Reviewed-on: #4
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
This commit is contained in:
Guillermo Bonet 2024-03-21 06:46:25 +00:00
commit dfa9570ea4
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')`);
}

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