change:推送重试重入队列+失败日志

This commit is contained in:
李鹏军 2024-04-22 22:14:35 +08:00
parent 71ec9f09cc
commit 2e551b21d7

View File

@ -105,22 +105,20 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
// 往es 写推送日志
await _trackPushRecordsRepository.AddAsync(log);
if (!log.IsSuccess) if (!log.IsSuccess)
{ {
// 重试过程中不会去更新订单主表
if (@event.RetryNum < 3) if (@event.RetryNum < 3)
{ {
@event.RetryNum++; @event.RetryNum++;
// 1, 2, 4min await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, @event);
await _capPublisher.PublishDelayAsync(
TimeSpan.FromSeconds((1 << @event.RetryNum - 1) * RandomHelper.GetRandom(30, 60)),
GlobalConst.TrackPushSubscribe, @event);
return; return;
} }
} }
// 往es 写推送日志
await _trackPushRecordsRepository.AddAsync(log);
// 同步去更新订单主表 // 同步去更新订单主表
await TrackPushAfterUpdateOrderAsync(new TrackPushAfterUpdateOrderDto await TrackPushAfterUpdateOrderAsync(new TrackPushAfterUpdateOrderDto
{ {