add worker event tracking; implement worker rates display in admin panel

This commit is contained in:
ImBenji
2026-04-23 17:26:15 +01:00
parent 30104c6e66
commit e10de8fcec
2 changed files with 45 additions and 58 deletions
+16 -1
View File
@@ -432,7 +432,22 @@ async function adminRoutes(fastify) {
FROM articles GROUP BY content_status ORDER BY n DESC
`).all();
return { total, withContent, withEmbedding, eventCount, bySource, byStatus };
const ingestedPerHour = db.prepare(`
SELECT COUNT(*) as n FROM articles WHERE ingested_at >= datetime('now', '-1 hour')
`).get().n;
const contentPerHour = db.prepare(`
SELECT COUNT(*) as n FROM articles WHERE content_attempted_at >= datetime('now', '-1 hour')
`).get().n;
let embeddingsPerHour = 0;
try {
embeddingsPerHour = db.prepare(`
SELECT COUNT(*) as n FROM article_embedding_meta WHERE embedded_at >= datetime('now', '-1 hour')
`).get().n;
} catch (_) {}
return { total, withContent, withEmbedding, eventCount, bySource, byStatus, ingestedPerHour, contentPerHour, embeddingsPerHour };
});
}