start a goroutine to clear expired workers when init a pool

This commit is contained in:
andy pan 2018-07-06 14:42:26 +08:00
parent 02a168974d
commit 5ae6239a57
2 changed files with 2 additions and 2 deletions

View File

@ -96,7 +96,7 @@ func NewPool(size, expiry int) (*Pool, error) {
release: make(chan sig, 1), release: make(chan sig, 1),
expiryDuration: time.Duration(expiry)*time.Second, expiryDuration: time.Duration(expiry)*time.Second,
} }
p.monitorAndClear()
return p, nil return p, nil
} }

View File

@ -97,7 +97,7 @@ func NewPoolWithFunc(size, expiry int, f pf) (*PoolWithFunc, error) {
expiryDuration: time.Duration(expiry)*time.Second, expiryDuration: time.Duration(expiry)*time.Second,
poolFunc: f, poolFunc: f,
} }
p.MonitorAndClear()
return p, nil return p, nil
} }