From 81ce4f67d35d3bfef6a20b8222bbe95720f82137 Mon Sep 17 00:00:00 2001 From: Yun Date: Sat, 4 Oct 2025 19:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=81=9C=E6=AD=A2=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E9=87=8A=E6=94=BE=E7=9A=84=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster.go | 6 ++++++ once.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/cluster.go b/cluster.go index 1449615..92359cc 100644 --- a/cluster.go +++ b/cluster.go @@ -113,6 +113,12 @@ func InitCluster(ctx context.Context, red redis.UniversalClient, keyPrefix strin // Stop 停止集群定时器 func (l *Cluster) Stop() { close(l.stopChan) + if l.cancel != nil { + l.cancel() + } + if l.usePriority && l.priority != nil { + l.priority.Close() + } l.cleanHeartbeat(true) l.wg.Wait() } diff --git a/once.go b/once.go index 4757635..62ee01b 100644 --- a/once.go +++ b/once.go @@ -166,6 +166,12 @@ func InitOnce(ctx context.Context, re redis.UniversalClient, keyPrefix string, c // Close 停止集群定时器 func (l *Once) Close() { close(l.stopChan) + if l.usePriority && l.priority != nil { + l.priority.Close() + } + if l.leader != nil { + l.leader.Close() + } l.heartbeat.Close() l.cancel() l.wg.Wait()