修复卡轮训的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 10m14s

This commit is contained in:
2026-04-26 12:41:16 +08:00
parent 7efcea2b54
commit a887f91686
5 changed files with 34 additions and 8 deletions

View File

@@ -107,6 +107,9 @@ func (h *PollingProtectHandler) Handle(ctx context.Context, t *asynq.Task) error
"stop_reason": constants.StopReasonProtectPeriod,
}); updateErr != nil {
h.base.logger.Warn("保护期停机 DB 更新失败", zap.Uint("card_id", cardID), zap.Error(updateErr))
h.base.invalidateCardCache(ctx, cardID)
h.base.updateStats(ctx, constants.TaskTypePollingProtect, false, time.Since(startTime))
return h.base.requeueCard(ctx, cardID, constants.TaskTypePollingProtect)
}
h.base.updateCardCache(ctx, cardID, map[string]any{"network_status": constants.NetworkStatusOffline})
actionTaken = "forced_stop"
@@ -130,6 +133,9 @@ func (h *PollingProtectHandler) Handle(ctx context.Context, t *asynq.Task) error
"stop_reason": "",
}); updateErr != nil {
h.base.logger.Warn("保护期复机 DB 更新失败", zap.Uint("card_id", cardID), zap.Error(updateErr))
h.base.invalidateCardCache(ctx, cardID)
h.base.updateStats(ctx, constants.TaskTypePollingProtect, false, time.Since(startTime))
return h.base.requeueCard(ctx, cardID, constants.TaskTypePollingProtect)
}
h.base.updateCardCache(ctx, cardID, map[string]any{"network_status": constants.NetworkStatusOnline})
actionTaken = "forced_resume"