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 9 additions and 9 deletions
Showing only changes of commit 7d68eaa3ac - Show all commits

View File

@ -156,11 +156,19 @@ 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}`);
} }
async function eventScheduler(isActive) {
await conn.query(
`SET GLOBAL event_scheduler = ${isActive ? 'ON' : 'OFF'}`
);
}
async function releaseLock() { async function releaseLock() {
await conn.query(`DO RELEASE_LOCK('myt_push')`); await conn.query(`DO RELEASE_LOCK('myt_push')`);
await eventScheduler(true);
} }
try { try {
await eventScheduler(false);
guillermo marked this conversation as resolved Outdated
Outdated
Review

Mover antes del RELEASE_LOCK

Mover antes del RELEASE_LOCK
await this.push(myt, opts, conn); await this.push(myt, opts, conn);
} catch(err) { } catch(err) {
try { try {
@ -225,7 +233,6 @@ class Push extends Command {
// Apply versions // Apply versions
this.emit('applyingVersions'); this.emit('applyingVersions');
await this.eventScheduler(false);
let nVersions = 0; let nVersions = 0;
let nChanges = 0; let nChanges = 0;
@ -343,7 +350,6 @@ class Push extends Command {
await conn.query('FLUSH PRIVILEGES'); await conn.query('FLUSH PRIVILEGES');
await conn.query(`DROP TEMPORARY TABLE tProcsPriv`); await conn.query(`DROP TEMPORARY TABLE tProcsPriv`);
} }
await this.eventScheduler(true);
} }
for (const change of changes) for (const change of changes)
@ -535,12 +541,6 @@ class Push extends Command {
return a.path.localeCompare(b.path); return a.path.localeCompare(b.path);
}); });
} }
async eventScheduler(isActive) {
await conn.query(
`SET GLOBAL event_scheduler = ${isActive ? 'ON' : 'OFF'}`
);
}
} }
const typeMap = { const typeMap = {

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