From e9f5d0c06f3577ffe200764ea63ce4b64730d346 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 22 Feb 2019 23:25:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=B9=20Reduce=20the=20threshold=20time?= =?UTF-8?q?=20of=20cleaning=20up=20goroutines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ants.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ants.go b/ants.go index f1bcd35..d840e8d 100644 --- a/ants.go +++ b/ants.go @@ -33,7 +33,7 @@ const ( DefaultAntsPoolSize = math.MaxInt32 // DefaultCleanIntervalTime is the interval time to clean up goroutines. - DefaultCleanIntervalTime = 5 + DefaultCleanIntervalTime = 1 ) var ( @@ -64,10 +64,11 @@ var ( // new connections if WorkerFunc is CPU-bound. return 1 }() + + defaultAntsPool, _ = NewPool(DefaultAntsPoolSize) ) // Init a instance pool when importing ants. -var defaultAntsPool, _ = NewPool(DefaultAntsPoolSize) // Submit submits a task to pool. func Submit(task func()) error {