From 8bb0cde224fdf3a1c6915b4dbd943bc506b42257 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Sat, 23 Feb 2019 00:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=8F=20Reduce=20the=20threshold=20time?= =?UTF-8?q?=20of=20cleaning=20up=20goroutines=20in=20test=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ants_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ants_test.go b/ants_test.go index f853585..c46223e 100644 --- a/ants_test.go +++ b/ants_test.go @@ -245,23 +245,23 @@ func TestPoolPanicWithoutHandler(t *testing.T) { } func TestPurge(t *testing.T) { - p, err := ants.NewTimingPool(10, 1) + p, err := ants.NewPool(10) defer p.Release() if err != nil { t.Fatalf("create TimingPool failed: %s", err.Error()) } p.Submit(demoFunc) - time.Sleep(ants.DefaultCleanIntervalTime * time.Second) + time.Sleep(3 * ants.DefaultCleanIntervalTime * time.Second) if p.Running() != 0 { t.Error("all p should be purged") } - p1, err := ants.NewTimingPoolWithFunc(10, 1, demoPoolFunc) + p1, err := ants.NewPoolWithFunc(10, demoPoolFunc) defer p1.Release() if err != nil { t.Fatalf("create TimingPoolWithFunc failed: %s", err.Error()) } p1.Invoke(1) - time.Sleep(ants.DefaultCleanIntervalTime * time.Second) + time.Sleep(3 * ants.DefaultCleanIntervalTime * time.Second) if p.Running() != 0 { t.Error("all p should be purged") }