fix(basic.gblib): Fix Scheduling.

This commit is contained in:
Rodrigo Rodriguez 2024-03-16 22:50:30 -03:00
parent 0451c4ca31
commit 1a5f76f2ac

View file

@ -273,6 +273,12 @@ export class GBVMService extends GBService {
if (Fs.existsSync(filePath)) { if (Fs.existsSync(filePath)) {
connections = JSON.parse(Fs.readFileSync(filePath, 'utf8')); connections = JSON.parse(Fs.readFileSync(filePath, 'utf8'));
} }
const shouldSync = min.core.getParam<boolean>(
min.instance,
'Synchronize Database',
false
);
tableDef.forEach(async t => { tableDef.forEach(async t => {
const tableName = t.name.trim(); const tableName = t.name.trim();
@ -371,8 +377,8 @@ export class GBVMService extends GBService {
equals++; equals++;
} }
} }
});
});
if (equals != Object.keys(t.fields).length) { if (equals != Object.keys(t.fields).length) {
sync = true; sync = true;
@ -405,7 +411,6 @@ export class GBVMService extends GBService {
sync = sync ? sync : !found; sync = sync ? sync : !found;
associations.forEach(e => { associations.forEach(e => {
const from = seq.models[e.from]; const from = seq.models[e.from];
const to = seq.models[e.to]; const to = seq.models[e.to];
@ -418,11 +423,6 @@ export class GBVMService extends GBService {
}); });
const shouldSync = min.core.getParam<boolean>(
min.instance,
'Synchronize Database',
false
);
if (sync && shouldSync) { if (sync && shouldSync) {
@ -434,9 +434,6 @@ export class GBVMService extends GBService {
}); });
GBLogEx.info(min, `BASIC: Done sync for ${min.botId} ${connectionName} ${tableName} storage table...`); GBLogEx.info(min, `BASIC: Done sync for ${min.botId} ${connectionName} ${tableName} storage table...`);
} }
else {
GBLogEx.verbose(min, `BASIC: TABLE ${tableName} keywords already up to date ${connectionName} (${min.botId})...`);
}
} }
}); });
} }