mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-16 18:11:03 +00:00
fixed the "slice bounds out of range" error
This commit is contained in:
parent
3e6386d097
commit
b21f63142d
6
pool.go
6
pool.go
@ -77,8 +77,10 @@ func (p *Pool) monitorAndClear() {
|
||||
w.stop()
|
||||
idleWorkers[i] = nil
|
||||
}
|
||||
n += 1
|
||||
p.workers = idleWorkers[n:]
|
||||
if n > 0 {
|
||||
n += 1
|
||||
p.workers = idleWorkers[n:]
|
||||
}
|
||||
p.lock.Unlock()
|
||||
}
|
||||
}()
|
||||
|
||||
@ -78,8 +78,10 @@ func (p *PoolWithFunc) MonitorAndClear() {
|
||||
w.stop()
|
||||
idleWorkers[i] = nil
|
||||
}
|
||||
n += 1
|
||||
p.workers = idleWorkers[n:]
|
||||
if n > 0 {
|
||||
n += 1
|
||||
p.workers = idleWorkers[n:]
|
||||
}
|
||||
p.lock.Unlock()
|
||||
}
|
||||
}()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user