openvibers/openvibe.network Commits
Production drift: the registry exposes releases() (the drift checks called it and failed silently), and a failed refresh is logged
Changes
@@@ -79,9 +79,10 @@ function createDeployDrift({ services, fetchImpl = globalThis.fetch, token = ()}function start() {if (timer) return;-- const first = setTimeout(() => { refresh().catch(() => {}); }, 60 * 1000);++ const run = () => refresh().catch((err) => { if (log && log.warn) log.warn(`[drift] refresh failed: ${err.message}`); });++ const first = setTimeout(run, 60 * 1000);if (first.unref) first.unref();-- timer = setInterval(() => { refresh().catch(() => {}); }, intervalMs);++ timer = setInterval(run, intervalMs);if (timer.unref) timer.unref();}function stop() { if (timer) clearInterval(timer); timer = null; }@@@ -380,7 +380,7 @@ function createEcosystemRegistry({ issuer, internalOverrides = {}, fetchImpl = greturn r;}-- return { router, start, stop, pollAll, health, current, descriptor, categories, featured, setRanking: (fn) => { rankingOf = fn; }, lastPollAt: () => lastPollAt, pollMs, internal };++ return { router, start, stop, pollAll, health, current, descriptor, categories, featured, releases, setRanking: (fn) => { rankingOf = fn; }, lastPollAt: () => lastPollAt, pollMs, internal };}module.exports = { createEcosystemRegistry, INTERNAL, READY_PATHS, HEALTH_PATHS, CATEGORIES, categoryOf, internalFromEnv, statusFromReady, readySummary };@@@ -58,5 +58,9 @@ const fetchImpl = async (url, opts) => {await d.refresh();assert.strictEqual(drift.current('media'), null, 'a service that stopped running is dropped');drift._reset();++ // server/index.js feeds the checks from the registry's releases view.++ const eco = require('../server/registry/ecosystem').createEcosystemRegistry({ issuer: 'https://openvibe.network', fetchImpl: async () => { throw new Error('offline'); } });++ assert.strictEqual(typeof eco.releases, 'function', 'the registry exposes releases()');++ assert.ok(Array.isArray(eco.releases().services));console.log('deploy drift: all checks passed');})().catch((err) => { console.error(err); process.exit(1); });
@@ -79,9 +79,10 @@ function createDeployDrift({ services, fetchImpl = globalThis.fetch, token = ()
@@ -79,9 +79,10 @@ function createDeployDrift({ services, fetchImpl = globalThis.fetch, token = ()
}
}
function start() {
function start() {
if (timer) return;
if (timer) return;
- const first = setTimeout(() => { refresh().catch(() => {}); }, 60 * 1000);
+ const run = () => refresh().catch((err) => { if (log && log.warn) log.warn(`[drift] refresh failed: ${err.message}`); });
+ const first = setTimeout(run, 60 * 1000);
if (first.unref) first.unref();
if (first.unref) first.unref();
- timer = setInterval(() => { refresh().catch(() => {}); }, intervalMs);
+ timer = setInterval(run, intervalMs);
if (timer.unref) timer.unref();
if (timer.unref) timer.unref();
}
}
function stop() { if (timer) clearInterval(timer); timer = null; }
function stop() { if (timer) clearInterval(timer); timer = null; }
@@ -380,7 +380,7 @@ function createEcosystemRegistry({ issuer, internalOverrides = {}, fetchImpl = g
@@ -380,7 +380,7 @@ function createEcosystemRegistry({ issuer, internalOverrides = {}, fetchImpl = g
return r;
return r;
}
}
- return { router, start, stop, pollAll, health, current, descriptor, categories, featured, setRanking: (fn) => { rankingOf = fn; }, lastPollAt: () => lastPollAt, pollMs, internal };
+ return { router, start, stop, pollAll, health, current, descriptor, categories, featured, releases, setRanking: (fn) => { rankingOf = fn; }, lastPollAt: () => lastPollAt, pollMs, internal };
}
}
module.exports = { createEcosystemRegistry, INTERNAL, READY_PATHS, HEALTH_PATHS, CATEGORIES, categoryOf, internalFromEnv, statusFromReady, readySummary };
module.exports = { createEcosystemRegistry, INTERNAL, READY_PATHS, HEALTH_PATHS, CATEGORIES, categoryOf, internalFromEnv, statusFromReady, readySummary };
@@ -58,5 +58,9 @@ const fetchImpl = async (url, opts) => {
@@ -58,5 +58,9 @@ const fetchImpl = async (url, opts) => {
await d.refresh();
await d.refresh();
assert.strictEqual(drift.current('media'), null, 'a service that stopped running is dropped');
assert.strictEqual(drift.current('media'), null, 'a service that stopped running is dropped');
drift._reset();
drift._reset();
+ // server/index.js feeds the checks from the registry's releases view.
+ const eco = require('../server/registry/ecosystem').createEcosystemRegistry({ issuer: 'https://openvibe.network', fetchImpl: async () => { throw new Error('offline'); } });
+ assert.strictEqual(typeof eco.releases, 'function', 'the registry exposes releases()');
+ assert.ok(Array.isArray(eco.releases().services));
console.log('deploy drift: all checks passed');
console.log('deploy drift: all checks passed');
})().catch((err) => { console.error(err); process.exit(1); });
})().catch((err) => { console.error(err); process.exit(1); });