forked from mirror/ants
🍹 Reduce the threshold time of cleaning up goroutines
This commit is contained in:
parent
96348a39f5
commit
e9f5d0c06f
5
ants.go
5
ants.go
|
@ -33,7 +33,7 @@ const (
|
||||||
DefaultAntsPoolSize = math.MaxInt32
|
DefaultAntsPoolSize = math.MaxInt32
|
||||||
|
|
||||||
// DefaultCleanIntervalTime is the interval time to clean up goroutines.
|
// DefaultCleanIntervalTime is the interval time to clean up goroutines.
|
||||||
DefaultCleanIntervalTime = 5
|
DefaultCleanIntervalTime = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -64,10 +64,11 @@ var (
|
||||||
// new connections if WorkerFunc is CPU-bound.
|
// new connections if WorkerFunc is CPU-bound.
|
||||||
return 1
|
return 1
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
defaultAntsPool, _ = NewPool(DefaultAntsPoolSize)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Init a instance pool when importing ants.
|
// Init a instance pool when importing ants.
|
||||||
var defaultAntsPool, _ = NewPool(DefaultAntsPoolSize)
|
|
||||||
|
|
||||||
// Submit submits a task to pool.
|
// Submit submits a task to pool.
|
||||||
func Submit(task func()) error {
|
func Submit(task func()) error {
|
||||||
|
|
Loading…
Reference in New Issue