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:
commit
dfa9570ea4
10
myt-push.js
10
myt-push.js
|
@ -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')`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue