rename the monitorAndClear function

This commit is contained in:
Andy Pan 2018-07-21 18:50:18 +08:00
parent 077ca09e0b
commit a326530368
2 changed files with 4 additions and 4 deletions

View File

@ -61,7 +61,7 @@ type Pool struct {
once sync.Once once sync.Once
} }
func (p *Pool) monitorAndClear() { func (p *Pool) periodicallyPurge() {
heartbeat := time.NewTicker(p.expiryDuration) heartbeat := time.NewTicker(p.expiryDuration)
go func() { go func() {
for range heartbeat.C { for range heartbeat.C {
@ -110,7 +110,7 @@ func NewTimingPool(size, expiry int) (*Pool, error) {
release: make(chan sig, 1), release: make(chan sig, 1),
expiryDuration: time.Duration(expiry) * time.Second, expiryDuration: time.Duration(expiry) * time.Second,
} }
p.monitorAndClear() p.periodicallyPurge()
return p, nil return p, nil
} }

View File

@ -62,7 +62,7 @@ type PoolWithFunc struct {
once sync.Once once sync.Once
} }
func (p *PoolWithFunc) monitorAndClear() { func (p *PoolWithFunc) periodicallyPurge() {
heartbeat := time.NewTicker(p.expiryDuration) heartbeat := time.NewTicker(p.expiryDuration)
go func() { go func() {
for range heartbeat.C { for range heartbeat.C {
@ -112,7 +112,7 @@ func NewTimingPoolWithFunc(size, expiry int, f pf) (*PoolWithFunc, error) {
expiryDuration: time.Duration(expiry) * time.Second, expiryDuration: time.Duration(expiry) * time.Second,
poolFunc: f, poolFunc: f,
} }
p.monitorAndClear() p.periodicallyPurge()
return p, nil return p, nil
} }