forked from mirror/ants
🐳 Add test cases for sync.Pool
This commit is contained in:
parent
840634ae51
commit
822158c59c
|
@ -82,7 +82,7 @@ func TestAntsPoolGetWorkerFromCache(t *testing.T) {
|
||||||
for i := 0; i < AntsSize; i++ {
|
for i := 0; i < AntsSize; i++ {
|
||||||
p.Submit(demoFunc)
|
p.Submit(demoFunc)
|
||||||
}
|
}
|
||||||
time.Sleep(ants.DefaultCleanIntervalTime * time.Second)
|
time.Sleep(2 * ants.DefaultCleanIntervalTime * time.Second)
|
||||||
p.Submit(demoFunc)
|
p.Submit(demoFunc)
|
||||||
t.Logf("pool, running workers number:%d", p.Running())
|
t.Logf("pool, running workers number:%d", p.Running())
|
||||||
mem := runtime.MemStats{}
|
mem := runtime.MemStats{}
|
||||||
|
@ -100,7 +100,7 @@ func TestAntsPoolWithFuncGetWorkerFromCache(t *testing.T) {
|
||||||
for i := 0; i < AntsSize; i++ {
|
for i := 0; i < AntsSize; i++ {
|
||||||
p.Serve(dur)
|
p.Serve(dur)
|
||||||
}
|
}
|
||||||
time.Sleep(ants.DefaultCleanIntervalTime * time.Second)
|
time.Sleep(2 * ants.DefaultCleanIntervalTime * time.Second)
|
||||||
p.Serve(dur)
|
p.Serve(dur)
|
||||||
t.Logf("pool, running workers number:%d", p.Running())
|
t.Logf("pool, running workers number:%d", p.Running())
|
||||||
mem := runtime.MemStats{}
|
mem := runtime.MemStats{}
|
||||||
|
|
Loading…
Reference in New Issue