From e2e6bcc8ce6cdf5383cda319d5ec9acad8f255f6 Mon Sep 17 00:00:00 2001 From: xing Date: Sun, 14 Apr 2024 23:08:22 +0800 Subject: [PATCH] fix bug --- cache/reload/reload.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cache/reload/reload.go b/cache/reload/reload.go index c149d29..e73f7e3 100644 --- a/cache/reload/reload.go +++ b/cache/reload/reload.go @@ -451,7 +451,18 @@ func Append(fn func(), a ...any) { ord, name := parseArgs(a...) autoExec := helper.ParseArgs(true, a...) once := helper.ParseArgs(0, a...) + queues := reloadQueues.Load() queue := Queue{fn, ord, name, autoExec, once == 1} + if name != "" { + i, _ := slice.SearchFirst(queues, func(queue Queue) bool { + return queue.Name == name + }) + if i > -1 { + queues[i] = queue + reloadQueues.Store(queues) + return + } + } reloadQueues.Append(queue) }