fix(loadbalance): prevent double-close panic in SlowStartManager.Stop()
Use atomic Swap instead of Load+close to prevent concurrent Stop() calls from both passing the check and closing the channel twice.
This commit is contained in:
parent
332b96031b
commit
ba0b3c55bb
@ -105,7 +105,7 @@ func (m *SlowStartManager) Start() {
|
|||||||
|
|
||||||
// Stop 停止后台更新。
|
// Stop 停止后台更新。
|
||||||
func (m *SlowStartManager) Stop() {
|
func (m *SlowStartManager) Stop() {
|
||||||
if !m.running.Load() {
|
if !m.running.Swap(false) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
close(m.stopCh)
|
close(m.stopCh)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user