mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-16 18:11:03 +00:00
rename the monitorAndClear function
This commit is contained in:
parent
077ca09e0b
commit
a326530368
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…
x
Reference in New Issue
Block a user