fix: 修复 server 包连接断开消息分发器阻塞的问题,优化等待消息时打印的日志频率

This commit is contained in:
kercylan98
2024-01-12 17:04:28 +08:00
parent 6f7868483f
commit af237448d7
2 changed files with 13 additions and 5 deletions

View File

@@ -116,7 +116,7 @@ func (d *Dispatcher[P, M]) Expel() {
func (d *Dispatcher[P, M]) noLockExpel() {
d.expel = true
if d.mc <= 0 {
d.abort <- struct{}{}
close(d.abort)
}
}
@@ -139,7 +139,7 @@ func (d *Dispatcher[P, M]) IncrCount(producer P, i int64) {
d.mc += i
d.pmc[producer] += i
if d.expel && d.mc <= 0 {
d.abort <- struct{}{}
close(d.abort)
}
}
@@ -190,7 +190,6 @@ func (d *Dispatcher[P, M]) Start() *Dispatcher[P, M] {
if ch := d.closedHandler.Load(); ch != nil {
(*ch)(&Action[P, M]{d: d, unlock: true})
}
close(d.abort)
}(d)
return d
}