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