aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-03-09 12:45:45 +0000
committerMohamed Bassem <me@mbassem.com>2025-03-09 12:45:45 +0000
commitf42a305fcbd68bf5983bdd75a784ea87e818fd2f (patch)
tree9f422e7326c254bc2d43c719c6bcedabc9435d2a
parent0c4ea74fb7cff67631152002915df12653896708 (diff)
downloadkarakeep-f42a305fcbd68bf5983bdd75a784ea87e818fd2f.tar.zst
fix: Fix missing workers in the server stats
-rw-r--r--apps/web/components/admin/ServerStats.tsx28
-rw-r--r--apps/web/lib/i18n/locales/en/translation.json4
-rw-r--r--packages/trpc/routers/admin.ts54
3 files changed, 86 insertions, 0 deletions
diff --git a/apps/web/components/admin/ServerStats.tsx b/apps/web/components/admin/ServerStats.tsx
index 1f0c7e9d..ded2c19f 100644
--- a/apps/web/components/admin/ServerStats.tsx
+++ b/apps/web/components/admin/ServerStats.tsx
@@ -140,6 +140,34 @@ export default function ServerStats() {
<TableCell>-</TableCell>
<TableCell>-</TableCell>
</TableRow>
+ <TableRow>
+ <TableCell>{t("admin.background_jobs.video_jobs")}</TableCell>
+ <TableCell>{serverStats.videoStats.queued}</TableCell>
+ <TableCell>-</TableCell>
+ <TableCell>-</TableCell>
+ </TableRow>
+ <TableRow>
+ <TableCell>{t("admin.background_jobs.webhook_jobs")}</TableCell>
+ <TableCell>{serverStats.webhookStats.queued}</TableCell>
+ <TableCell>-</TableCell>
+ <TableCell>-</TableCell>
+ </TableRow>
+ <TableRow>
+ <TableCell>
+ {t("admin.background_jobs.asset_preprocessing_jobs")}
+ </TableCell>
+ <TableCell>
+ {serverStats.assetPreprocessingStats.queued}
+ </TableCell>
+ <TableCell>-</TableCell>
+ <TableCell>-</TableCell>
+ </TableRow>
+ <TableRow>
+ <TableCell>{t("admin.background_jobs.feed_jobs")}</TableCell>
+ <TableCell>{serverStats.feedStats.queued}</TableCell>
+ <TableCell>-</TableCell>
+ <TableCell>-</TableCell>
+ </TableRow>
</TableBody>
</Table>
</div>
diff --git a/apps/web/lib/i18n/locales/en/translation.json b/apps/web/lib/i18n/locales/en/translation.json
index a12b703f..5ba4882c 100644
--- a/apps/web/lib/i18n/locales/en/translation.json
+++ b/apps/web/lib/i18n/locales/en/translation.json
@@ -177,6 +177,10 @@
"indexing_jobs": "Indexing Jobs",
"inference_jobs": "Inference Jobs",
"tidy_assets_jobs": "Tidy Assets Jobs",
+ "video_jobs": "Video Jobs",
+ "webhook_jobs": "Webhook Jobs",
+ "asset_preprocessing_jobs": "Asset Preprocessing Jobs",
+ "feed_jobs": "Feed Jobs",
"job": "Job",
"queued": "Queued",
"pending": "Pending",
diff --git a/packages/trpc/routers/admin.ts b/packages/trpc/routers/admin.ts
index 6393c950..bfdcbd37 100644
--- a/packages/trpc/routers/admin.ts
+++ b/packages/trpc/routers/admin.ts
@@ -5,12 +5,16 @@ import { z } from "zod";
import { assets, bookmarkLinks, bookmarks, users } from "@hoarder/db/schema";
import serverConfig from "@hoarder/shared/config";
import {
+ AssetPreprocessingQueue,
+ FeedQueue,
LinkCrawlerQueue,
OpenAIQueue,
SearchIndexingQueue,
TidyAssetsQueue,
triggerReprocessingFixMode,
triggerSearchReindex,
+ VideoWorkerQueue,
+ WebhookQueue,
} from "@hoarder/shared/queues";
import {
changeRoleSchema,
@@ -44,6 +48,18 @@ export const adminAppRouter = router({
tidyAssetsStats: z.object({
queued: z.number(),
}),
+ videoStats: z.object({
+ queued: z.number(),
+ }),
+ webhookStats: z.object({
+ queued: z.number(),
+ }),
+ assetPreprocessingStats: z.object({
+ queued: z.number(),
+ }),
+ feedStats: z.object({
+ queued: z.number(),
+ }),
}),
)
.query(async ({ ctx }) => {
@@ -66,6 +82,18 @@ export const adminAppRouter = router({
// Tidy Assets
queuedTidyAssets,
+
+ // Video
+ queuedVideo,
+
+ // Webhook
+ queuedWebhook,
+
+ // Asset Preprocessing
+ queuedAssetPreprocessing,
+
+ // Feed
+ queuedFeed,
] = await Promise.all([
ctx.db.select({ value: count() }).from(users),
ctx.db.select({ value: count() }).from(bookmarks),
@@ -97,6 +125,18 @@ export const adminAppRouter = router({
// Tidy Assets
TidyAssetsQueue.stats(),
+
+ // Video
+ VideoWorkerQueue.stats(),
+
+ // Webhook
+ WebhookQueue.stats(),
+
+ // Asset Preprocessing
+ AssetPreprocessingQueue.stats(),
+
+ // Feed
+ FeedQueue.stats(),
]);
return {
@@ -118,6 +158,20 @@ export const adminAppRouter = router({
tidyAssetsStats: {
queued: queuedTidyAssets.pending + queuedTidyAssets.pending_retry,
},
+ videoStats: {
+ queued: queuedVideo.pending + queuedVideo.pending_retry,
+ },
+ webhookStats: {
+ queued: queuedWebhook.pending + queuedWebhook.pending_retry,
+ },
+ assetPreprocessingStats: {
+ queued:
+ queuedAssetPreprocessing.pending +
+ queuedAssetPreprocessing.pending_retry,
+ },
+ feedStats: {
+ queued: queuedFeed.pending + queuedFeed.pending_retry,
+ },
};
}),
recrawlLinks: adminProcedure