From 5ae6239a5708657828ddfbdd5297e7e777bdb52c Mon Sep 17 00:00:00 2001 From: andy pan Date: Fri, 6 Jul 2018 14:42:26 +0800 Subject: [PATCH] start a goroutine to clear expired workers when init a pool --- pool.go | 2 +- pool_func.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pool.go b/pool.go index c94e5e8..40f2ba1 100644 --- a/pool.go +++ b/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 } diff --git a/pool_func.go b/pool_func.go index c6db78f..3d92730 100644 --- a/pool_func.go +++ b/pool_func.go @@ -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 }