From 309e22b6504e7a5aa0c977c528397d7388be8143 Mon Sep 17 00:00:00 2001 From: RunOnFlux Date: Mon, 27 Jan 2025 12:07:39 +0000 Subject: [PATCH] Update from https://github.com/RunOnFlux/flux/commit/161777d426afc53e56887b91e605ce720d17e007 --- services/appsService.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/services/appsService.js b/services/appsService.js index b6eccdf7..d47cc9db 100644 --- a/services/appsService.js +++ b/services/appsService.js @@ -9283,6 +9283,24 @@ async function trySpawningGlobalApplication() { trySpawningGlobalApplication(); return; } + if (runningAppList.length < 6) { + // check if there are connectivity to all nodes + // eslint-disable-next-line no-restricted-syntax + for (const node of runningAppList) { + const ip = node.ip.split(':')[0]; + const port = node.ip.split(':')[1] || 16127; + // eslint-disable-next-line no-await-in-loop + const isOpen = await fluxNetworkHelper.isPortOpen(ip, port); + if (!isOpen) { + log.info(`trySpawningGlobalApplication - Application ${appToRun} uses syncthing and instance running on ${ip}:${port} is not reachable, possible conenctivity issue`); + // eslint-disable-next-line no-await-in-loop + await serviceHelper.delay(30 * 60 * 1000); + trySpawningGlobalAppCache.delete(appToRun); + trySpawningGlobalApplication(); + return; + } + } + } } // ToDo: Move this to global