From 16a766cba10dcaf53cc413cee62a952031bef5bc Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 23 May 2023 19:40:55 +0800 Subject: [PATCH] Do not call nil handler for a dummy queue (#24880) A dummy queue doesn't really have a handler (see line 211), so the `safeHandler` can safely drop all items --- modules/queue/workerqueue.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/queue/workerqueue.go b/modules/queue/workerqueue.go index de4485fa5..5695c6cc2 100644 --- a/modules/queue/workerqueue.go +++ b/modules/queue/workerqueue.go @@ -239,7 +239,10 @@ func NewWorkerPoolQueueBySetting[T any](name string, queueSetting setting.QueueS log.Error("Recovered from panic in queue %q handler: %v\n%s", name, err, log.Stack(2)) } }() - return w.origHandler(t...) + if w.origHandler != nil { + return w.origHandler(t...) + } + return nil } return &w, nil