forked from mirror/ants
Merge branch 'develop'
This commit is contained in:
commit
7fb8ca409b
4
pool.go
4
pool.go
|
@ -61,7 +61,7 @@ type Pool struct {
|
|||
once sync.Once
|
||||
}
|
||||
|
||||
func (p *Pool) monitorAndClear() {
|
||||
func (p *Pool) periodicallyPurge() {
|
||||
heartbeat := time.NewTicker(p.expiryDuration)
|
||||
go func() {
|
||||
for range heartbeat.C {
|
||||
|
@ -110,7 +110,7 @@ func NewTimingPool(size, expiry int) (*Pool, error) {
|
|||
release: make(chan sig, 1),
|
||||
expiryDuration: time.Duration(expiry) * time.Second,
|
||||
}
|
||||
p.monitorAndClear()
|
||||
p.periodicallyPurge()
|
||||
return p, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ type PoolWithFunc struct {
|
|||
once sync.Once
|
||||
}
|
||||
|
||||
func (p *PoolWithFunc) monitorAndClear() {
|
||||
func (p *PoolWithFunc) periodicallyPurge() {
|
||||
heartbeat := time.NewTicker(p.expiryDuration)
|
||||
go func() {
|
||||
for range heartbeat.C {
|
||||
|
@ -112,7 +112,7 @@ func NewTimingPoolWithFunc(size, expiry int, f pf) (*PoolWithFunc, error) {
|
|||
expiryDuration: time.Duration(expiry) * time.Second,
|
||||
poolFunc: f,
|
||||
}
|
||||
p.monitorAndClear()
|
||||
p.periodicallyPurge()
|
||||
return p, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue