by Robin at 20240624

This commit is contained in:
Leufolium 2024-06-24 21:30:52 +08:00
parent 900a803525
commit 5fcfea53ab
1 changed files with 7 additions and 5 deletions

View File

@ -597,12 +597,14 @@ func (s *CronService) ReloadBlockedFromBeingSearchedList(ctx context.Context, pa
}
// 加载缓存
blockedlist := make([]string, 0)
for _, acctpunishment := range list {
err := redis.GetRedisClient().RPush(consts.RedisStreamerPrefix+"blocked_from_being_searched_list", fmt.Sprint(acctpunishment.GetMid()))
if err != nil {
logger.Error("Redis cache fail, err: %v", err)
return fmt.Sprintf("Redis cache fail, err: %v", err)
}
blockedlist = append(blockedlist, fmt.Sprint(acctpunishment.GetMid()))
}
err = redis.GetRedisClient().Set(consts.RedisStreamerPrefix+"blocked_from_being_searched_list", blockedlist, 0)
if err != nil {
logger.Error("Redis cache fail, err: %v", err)
return fmt.Sprintf("Redis cache fail, err: %v", err)
}
logger.Info("Refresh blocked-from-being-searched list cached in redis accomplished...")