feat: refs #5846 Requested changes
This commit is contained in:
parent
823de4889f
commit
3324175483
|
@ -133,9 +133,6 @@ class Push extends Command {
|
||||||
if (opts.remote == 'local')
|
if (opts.remote == 'local')
|
||||||
opts.commit = true;
|
opts.commit = true;
|
||||||
|
|
||||||
const [[scheduler]] = await conn.query(`SELECT @@event_scheduler state`);
|
|
||||||
if (scheduler.state === 'ON') await eventScheduler(false);
|
|
||||||
|
|
||||||
// Obtain exclusive lock
|
// Obtain exclusive lock
|
||||||
|
|
||||||
const [[row]] = await conn.query(
|
const [[row]] = await conn.query(
|
||||||
|
@ -156,10 +153,12 @@ class Push extends Command {
|
||||||
isUsed = row.isUsed;
|
isUsed = row.isUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheduler.state === 'ON') await eventScheduler(false);
|
|
||||||
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) {
|
async function eventScheduler(isActive) {
|
||||||
await conn.query(
|
await conn.query(
|
||||||
`SET GLOBAL event_scheduler = ${isActive ? 'ON' : 'OFF'}`
|
`SET GLOBAL event_scheduler = ${isActive ? 'ON' : 'OFF'}`
|
||||||
|
@ -167,8 +166,8 @@ class Push extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function releaseLock() {
|
async function releaseLock() {
|
||||||
await conn.query(`DO RELEASE_LOCK('myt_push')`);
|
|
||||||
if (scheduler.state === 'ON') await eventScheduler(true);
|
if (scheduler.state === 'ON') await eventScheduler(true);
|
||||||
|
await conn.query(`DO RELEASE_LOCK('myt_push')`);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue