关于上游流量同步覆盖修复,以及新增redis同步迁移
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m25s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m25s
This commit is contained in:
@@ -113,6 +113,26 @@ func (m *PollingQueueManager) RemoveFromAllQueues(ctx context.Context, cardID ui
|
||||
return err
|
||||
}
|
||||
|
||||
// RemoveBatchFromCurrentShardQueues 批量移除卡在当前分片队列中的旧成员,并清理卡缓存。
|
||||
// 迁移收尾重建队列前使用,避免重复执行时残留旧任务类型或旧缓存。
|
||||
func (m *PollingQueueManager) RemoveBatchFromCurrentShardQueues(ctx context.Context, cardIDs []uint) error {
|
||||
if len(cardIDs) == 0 {
|
||||
return nil
|
||||
}
|
||||
pipe := m.redis.Pipeline()
|
||||
for _, cardID := range cardIDs {
|
||||
member := fmt.Sprintf("%d", cardID)
|
||||
shardID := int(cardID) % m.shardCount
|
||||
for _, taskType := range allTaskTypes {
|
||||
key := constants.RedisPollingShardQueueKey(shardID, taskType)
|
||||
pipe.ZRem(ctx, key, member)
|
||||
}
|
||||
pipe.Del(ctx, constants.RedisPollingCardInfoKey(cardID))
|
||||
}
|
||||
_, err := pipe.Exec(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// EnqueueManual 手动触发入队(List RPUSH,调度器优先消费)
|
||||
func (m *PollingQueueManager) EnqueueManual(ctx context.Context, cardID uint, taskType string) error {
|
||||
key := constants.RedisPollingManualQueueKey(taskType)
|
||||
|
||||
Reference in New Issue
Block a user