Skip to content

Commit

Permalink
Fix plus logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cabecinha84 committed Nov 15, 2024
1 parent a4ad2dc commit 6cfaff6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ZelBack/src/services/appsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9080,6 +9080,7 @@ async function trySpawningGlobalApplication() {

const db = dbHelper.databaseConnection();
const database = db.db(config.database.appsglobal.database);
log.info('Checking for apps that are missing instances on the network.');
let globalAppNamesLocation = await dbHelper.aggregateInDatabase(database, globalAppsInformation, pipeline);
const numberOfGlobalApps = globalAppNamesLocation.length;
if (!numberOfGlobalApps) {
Expand All @@ -9088,6 +9089,7 @@ async function trySpawningGlobalApplication() {
trySpawningGlobalApplication();
return;
}
log.info(`Found ${numberOfGlobalApps} that are missing instances on the network.`);

let appToRun = null;
let minInstances = null;
Expand All @@ -9100,8 +9102,9 @@ async function trySpawningGlobalApplication() {
appFromAppsToBeCheckedLater = true;
} else {
const myNodeLocation = nodeFullGeolocation();
globalAppNamesLocation = globalAppNamesLocation.filter((app) => (!app.geolocation.lengh === 0 || app.geolocation.find((loc) => `ac${myNodeLocation}`.startsWith(loc)))
|| (app.nodes.lengh === 0 || app.nodes.find((ip) => ip === myIP)));
globalAppNamesLocation = globalAppNamesLocation.filter((app) => (app.geolocation.length === 0 || app.geolocation.find((loc) => `ac${myNodeLocation}`.startsWith(loc)))
|| (app.nodes.length === 0 || app.nodes.find((ip) => ip === myIP)));
log.info(`Found ${globalAppNamesLocation.length} apps that are missing instances on the network and can be selected to try to spawn on my node.`);
// eslint-disable-next-line no-restricted-syntax
for (const appToRunAux of globalAppNamesLocation) {
if (!trySpawningGlobalAppCache.has(appToRunAux.name) && !appsToBeCheckedLater.includes((app) => app.appName === appToRunAux.name)) {
Expand Down

0 comments on commit 6cfaff6

Please sign in to comment.