Probe Ranker health tables

This commit is contained in:
OpenClaw Bot
2026-05-27 14:47:51 +02:00
parent 578f954020
commit 3ff7272720
+24 -8
View File
@@ -251,17 +251,33 @@ async function logActivity(type, message, ideaId = '', meta = '') {
} }
app.get('/api/health', async (_req, res) => { app.get('/api/health', async (_req, res) => {
const health = { ok: false, app: 'rank', version: appVersion, appwriteConfigured: Boolean(endpoint && projectId && apiKey), appwriteReachable: false, tableReachable: false }; const health = {
ok: false,
app: 'rank',
version: appVersion,
appwriteConfigured: Boolean(endpoint && projectId && apiKey),
appwriteReachable: false,
tableReachable: false,
tables: { ideas: false, milestones: false, activity: false },
};
try { try {
if (health.appwriteConfigured) { if (health.appwriteConfigured) {
const probe = await withTimeout( const tableProbes = [
tables.listRows({ databaseId, tableId: ideasTableId, queries: [Query.limit(1)] }), ['ideas', ideasTableId],
'Appwrite health probe' ['milestones', milestonesTableId],
); ['activity', activityTableId],
rowsFrom(probe); ];
for (const [name, tableId] of tableProbes) {
const probe = await withTimeout(
tables.listRows({ databaseId, tableId, queries: [Query.limit(1)] }),
`Appwrite health probe (${name})`
);
rowsFrom(probe);
health.tables[name] = true;
}
health.appwriteReachable = true; health.appwriteReachable = true;
health.tableReachable = true; health.tableReachable = Object.values(health.tables).every(Boolean);
health.ok = true; health.ok = health.tableReachable;
} }
} catch (error) { } catch (error) {
health.error = error.message; health.error = error.message;