mirror of
https://github.com/chainreactors/spray.git
synced 2026-10-24 08:54:30 +00:00
fix: pool wg negative count
This commit is contained in:
1 parent
6618e025c3
commit
a3d7d1eccb
1 file changed
+8
-10
+8
-10
@@ -48,17 +48,15 @@ func (pool *BasePool) addAddition(u *Unit) {
|
||||
select {
|
||||
case pool.additionCh <- u:
|
||||
default:
|
||||
// 强行屏蔽报错, 防止goroutine泄露
|
||||
go func() {
|
||||
select {
|
||||
case pool.additionCh <- u:
|
||||
case <-pool.ctx.Done():
|
||||
pool.wg.Done()
|
||||
}
|
||||
}()
|
||||
}
|
||||
pool.wg.Add(1)
|
||||
// 强行屏蔽报错, 防止goroutine泄露
|
||||
go func() {
|
||||
select {
|
||||
case pool.additionCh <- u:
|
||||
pool.wg.Done()
|
||||
case <-pool.ctx.Done():
|
||||
pool.wg.Done()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (pool *BasePool) putToOutput(bl *baseline.Baseline) {
|
||||
|
||||
Reference in new issue
Block a user