fix(sticky): recreate stopCh on Start to support restart

This commit is contained in:
xfy 2026-06-08 17:52:20 +08:00
parent 0a5443f6cf
commit a73da4e14a

View File

@ -59,6 +59,9 @@ func (s *StickySession) Start() {
if s.started.Swap(true) { if s.started.Swap(true) {
return return
} }
// 重新创建 stopCh 以支持 Start/Stop/Start 模式
s.stopCh = make(chan struct{})
s.stopOnce = sync.Once{}
s.wg.Add(1) s.wg.Add(1)
go s.cleanupLoop() go s.cleanupLoop()
} }