bilibili-backup/app/interface/main/app-intl/service/feed/black.go

36 lines
599 B
Go
Raw Normal View History

2019-04-22 10:59:20 +08:00
package feed
import (
"context"
"time"
"go-common/library/log"
)
// loadBlackCache is.
func (s *Service) loadBlackCache() {
bs, err := s.blk.Black(context.Background())
if err != nil {
log.Error("s.blk.Black error(%v)", err)
return
}
s.blackCache = bs
log.Info("reBlackList success")
}
// blackproc load blacklist cache.
func (s *Service) blackproc() {
for {
time.Sleep(s.tick)
s.loadBlackCache()
}
}
// BlackList is.
func (s *Service) BlackList(c context.Context, mid int64) (aidm map[int64]struct{}, err error) {
if mid == 0 {
return
}
return s.blk.BlackList(c, mid)
}