format. Add separate tick for cache cleaning

This commit is contained in:
Jared Wasinger 2018-04-04 21:26:14 +00:00
parent c63b036812
commit 8054d2f3a6

View file

@ -177,7 +177,10 @@ func (self *Pss) Start(srv *p2p.Server) error {
go func() { go func() {
for { for {
tickC := time.Tick(defaultCleanInterval) tickC := time.Tick(defaultCleanInterval)
cacheTickC := time.Tick(cacheTTL)
select { select {
case <-cacheTickC:
self.cleanFwdCache()
case <-tickC: case <-tickC:
self.cleanKeys() self.cleanKeys()
case <-self.quitC: case <-self.quitC: