Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Cabecinha84 committed Feb 5, 2025
1 parent 6f54e63 commit eda9075
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
25 changes: 12 additions & 13 deletions ZelBack/src/services/appsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -11997,28 +11997,27 @@ async function monitorSharedDBApps() {
log.info(`monitorSharedDBApps: ${installedApp.name} going to check operator status on url ${url}`);
// eslint-disable-next-line no-await-in-loop
const operatorStatus = await serviceHelper.axiosGet(url).catch((error) => log.error(`monitorSharedDBApps: ${installedApp.name} operatorStatus error: ${error}`));
if (operatorStatus) {
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatus response ${JSON.stringify(operatorStatus.data)}`);
}
if (operatorStatus.data && operatorStatus.data.status !== 'OK') {
if (operatorStatus.data && operatorStatus.data.status !== 'OK' && operatorStatus.data.clusterStatus.length > 1) {
const sequence = operatorStatus.data.sequenceNumber || 0;
log.info(`monitorSharedDBApps: ${installedApp.name} status is not OK and sequenceNumber is ${sequence}`);
// eslint-disable-next-line no-await-in-loop
await serviceHelper.delay(2.5 * 60 * 1000); // operator status api cache is updated every 2 minutes
// eslint-disable-next-line no-await-in-loop
const operatorStatusDoubleCheck = await serviceHelper.axiosGet(url).catch((error) => log.error(`monitorSharedDBApps: ${installedApp.name} operatorStatus double check error: ${error}`));
if (operatorStatusDoubleCheck) {
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatus double check response ${JSON.stringify(operatorStatusDoubleCheck.data)}`);
}
if (operatorStatusDoubleCheck.data && operatorStatusDoubleCheck.data.status !== 'OK' && sequence === operatorStatusDoubleCheck.data.sequenceNumber) {
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatusDoubleCheck is not OK and sequence number is not syncing, going to uninstall the app}`);
// eslint-disable-next-line no-await-in-loop
await removeAppLocally(installedApp.name, null, true, false, true);
if (operatorStatusDoubleCheck.data && operatorStatusDoubleCheck.data.status !== 'OK' && operatorStatusDoubleCheck.data.clusterStatus.length > 1) {
const auxSequence = operatorStatusDoubleCheck.data.sequenceNumber || 0;
if (sequence === auxSequence) {
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatusDoubleCheck is not OK and sequence number is not syncing, going to uninstall the app`);
// eslint-disable-next-line no-await-in-loop
await removeAppLocally(installedApp.name, null, true, false, true);
} else {
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatusDoubleCheck node is syncing`);
}
} else {
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatusDoubleCheck is OK or it is syncing}`);
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatusDoubleCheck is OK or there are no peers to connect to`);
}
} else {
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatus is OK}`);
log.info(`monitorSharedDBApps: ${installedApp.name} operatorStatus is OK`);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ZelBack/src/services/serviceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ async function startFluxFunctions() {
}, 30 * 1000);
setTimeout(() => {
appsService.monitorSharedDBApps(); // Monitor SharedDB Apps.
}, 5 * 1000);
}, 0.5 * 60 * 1000);
}, 60 * 1000);
}, 3 * 60 * 1000);
setTimeout(() => {
setInterval(() => { // every 30 mins (15 blocks)
appsService.continuousFluxAppHashesCheck();
Expand Down

0 comments on commit eda9075

Please sign in to comment.