Probe Ranker health tables

This commit is contained in:
OpenClaw Bot
2026-05-27 14:47:51 +02:00
parent 578f954020
commit 3ff7272720
+21 -5
View File
@@ -251,17 +251,33 @@ async function logActivity(type, message, ideaId = '', meta = '') {
}
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 {
if (health.appwriteConfigured) {
const tableProbes = [
['ideas', ideasTableId],
['milestones', milestonesTableId],
['activity', activityTableId],
];
for (const [name, tableId] of tableProbes) {
const probe = await withTimeout(
tables.listRows({ databaseId, tableId: ideasTableId, queries: [Query.limit(1)] }),
'Appwrite health probe'
tables.listRows({ databaseId, tableId, queries: [Query.limit(1)] }),
`Appwrite health probe (${name})`
);
rowsFrom(probe);
health.tables[name] = true;
}
health.appwriteReachable = true;
health.tableReachable = true;
health.ok = true;
health.tableReachable = Object.values(health.tables).every(Boolean);
health.ok = health.tableReachable;
}
} catch (error) {
health.error = error.message;