feat(system): add runtime task queue observability dashboard for system admins

Expose live asynq queue depths and worker-pool concurrency via a new SystemAdmin API and settings UI, so operators can monitor parsing/wiki backlog without Redis CLI access.
This commit is contained in:
wizardchen
2026-07-10 22:36:58 +08:00
committed by lyingbug
parent 30f7630ac4
commit fe47ac1f96
16 changed files with 1339 additions and 22 deletions
@@ -120,6 +120,12 @@ func (f fakeTaskInspector) HasQueuedTasksForKnowledge(
return f.queued[knowledgeID], nil
}
func (f fakeTaskInspector) QueueStats(
_ context.Context,
) ([]types.QueueStat, bool, error) {
return nil, false, nil
}
func newHousekeepingSvcForTest(db *gorm.DB) *HousekeepingService {
return newHousekeepingSvcWithInspector(db, fakeTaskInspector{})
}
@@ -2246,7 +2246,7 @@ func (s *knowledgeService) ReparseKnowledge(
// - Any in-flight worker reads the new status at its next checkpoint and
// bails (see processChunks / ProcessDocument / downstream handlers).
// - The asynq inspector (if available) dequeues pending / scheduled / retry
// tasks for this knowledge_id across the default / critical / low queues
// tasks for this knowledge_id across all queues used by the pipeline
// and signals active workers to stop. Lite mode (no Redis) skips the
// dequeue step — the checkpoint-based abort is the only stop signal there.
// - Idempotent: re-calling on an already-cancelled row is a no-op.