fix(task-inspector): handle lazy queue not found errors

This commit is contained in:
lhy
2026-07-23 13:05:47 +08:00
committed by lyingbug
parent 0869f3e829
commit c74b0caa35
4 changed files with 111 additions and 4 deletions
+4 -4
View File
@@ -187,9 +187,9 @@ func (a *asynqTaskInspector) HasQueuedTasksForKnowledge(
// into. Read-only: it calls Inspector.GetQueueInfo per queue and maps
// the result onto types.QueueStat, attaching static pool/weight metadata
// from the central queue registry. A queue that has never received a task yields
// ErrQueueNotFound from asynq; we still surface it as a zeroed row so the
// dashboard shows the complete lane set even before a queue receives its
// first task.
// either ErrQueueNotFound or an internal NOT_FOUND error from asynq; we still
// surface it as a zeroed row so the dashboard shows the complete lane set even
// before a queue receives its first task.
func (a *asynqTaskInspector) QueueStats(
ctx context.Context,
) ([]types.QueueStat, bool, error) {
@@ -207,7 +207,7 @@ func (a *asynqTaskInspector) QueueStats(
}
info, err := a.inspector.GetQueueInfo(queue)
if err != nil {
if !errors.Is(err, asynq.ErrQueueNotFound) {
if !isAsynqQueueNotFound(err) {
logger.Warnf(ctx, "[TaskInspector] queue info queue=%s: %v", queue, err)
}
// Zeroed row: queue not created yet (or transient error).