You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
599 B
35 lines
599 B
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) |
|
}
|
|
|