mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-16 18:11:03 +00:00
start a goroutine to clear expired workers when init a pool
This commit is contained in:
parent
02a168974d
commit
5ae6239a57
2
pool.go
2
pool.go
@ -96,7 +96,7 @@ func NewPool(size, expiry int) (*Pool, error) {
|
||||
release: make(chan sig, 1),
|
||||
expiryDuration: time.Duration(expiry)*time.Second,
|
||||
}
|
||||
|
||||
p.monitorAndClear()
|
||||
return p, nil
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ func NewPoolWithFunc(size, expiry int, f pf) (*PoolWithFunc, error) {
|
||||
expiryDuration: time.Duration(expiry)*time.Second,
|
||||
poolFunc: f,
|
||||
}
|
||||
|
||||
p.MonitorAndClear()
|
||||
return p, nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user