mirror of https://github.com/panjf2000/ants.git
Merge branch 'develop'
This commit is contained in:
commit
b5fd3ba09c
2
pool.go
2
pool.go
|
@ -62,6 +62,8 @@ type Pool struct {
|
||||||
// clear expired workers periodically.
|
// clear expired workers periodically.
|
||||||
func (p *Pool) periodicallyPurge() {
|
func (p *Pool) periodicallyPurge() {
|
||||||
heartbeat := time.NewTicker(p.expiryDuration)
|
heartbeat := time.NewTicker(p.expiryDuration)
|
||||||
|
defer heartbeat.Stop()
|
||||||
|
|
||||||
for range heartbeat.C {
|
for range heartbeat.C {
|
||||||
currentTime := time.Now()
|
currentTime := time.Now()
|
||||||
p.lock.Lock()
|
p.lock.Lock()
|
||||||
|
|
|
@ -63,6 +63,8 @@ type PoolWithFunc struct {
|
||||||
// clear expired workers periodically.
|
// clear expired workers periodically.
|
||||||
func (p *PoolWithFunc) periodicallyPurge() {
|
func (p *PoolWithFunc) periodicallyPurge() {
|
||||||
heartbeat := time.NewTicker(p.expiryDuration)
|
heartbeat := time.NewTicker(p.expiryDuration)
|
||||||
|
defer heartbeat.Stop()
|
||||||
|
|
||||||
for range heartbeat.C {
|
for range heartbeat.C {
|
||||||
currentTime := time.Now()
|
currentTime := time.Now()
|
||||||
p.lock.Lock()
|
p.lock.Lock()
|
||||||
|
|
Loading…
Reference in New Issue