MCPcopy Create free account
hub / github.com/EvoMap/evolver / checkProxyHealth

Function checkProxyHealth

src/ops/lifecycle.js:323–339  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

321}
322
323function checkProxyHealth(env) {
324 if (!expectsProxy(env)) return { healthy: true, expected: false };
325 var proxy = readSettings().proxy || {};
326 if (!proxy.url) {
327 return { healthy: false, expected: true, reason: 'proxy_not_configured' };
328 }
329 if (proxy.pid && !isPidRunning(proxy.pid)) {
330 return { healthy: false, expected: true, reason: 'proxy_pid_stale', proxyPid: proxy.pid, proxyUrl: proxy.url };
331 }
332 if (!proxy.token) {
333 return { healthy: false, expected: true, reason: 'proxy_token_missing', proxyPid: proxy.pid, proxyUrl: proxy.url };
334 }
335 if (!isProxyUrlReachable(proxy.url, proxy.token)) {
336 return { healthy: false, expected: true, reason: 'proxy_unreachable', proxyPid: proxy.pid, proxyUrl: proxy.url };
337 }
338 return { healthy: true, expected: true, proxyPid: proxy.pid, proxyUrl: proxy.url };
339}
340
341function shouldRestartForProxy(pids, env) {
342 if (!pids || pids.length === 0) return false;

Callers 2

shouldRestartForProxyFunction · 0.85
checkHealthFunction · 0.85

Calls 4

expectsProxyFunction · 0.85
readSettingsFunction · 0.85
isPidRunningFunction · 0.85
isProxyUrlReachableFunction · 0.85

Tested by

no test coverage detected