This commit is contained in:
xiaolipro 2025-01-15 10:35:30 +08:00
parent 19548b3fc2
commit 4473936577
2 changed files with 5 additions and 0 deletions

View File

@ -144,6 +144,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
return false; return false;
} }
// todo: 在这里,判断存在性
return true; return true;
} }

View File

@ -55,6 +55,7 @@ public partial class TrackService : ApplicationService, ITrackService
[HttpPost("Track/Upsert")] [HttpPost("Track/Upsert")]
public async Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input) public async Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input)
{ {
// todo: 代码太长了
var order = await _orderRepository.GetFirstAsync(x => var order = await _orderRepository.GetFirstAsync(x =>
x.SubSystemId == input.SubSystemId && x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x.SubSystemId == input.SubSystemId && x.OrderType == input.OrderType && x.OrderNo == input.OrderNo,
x => new x => new
@ -119,6 +120,7 @@ public partial class TrackService : ApplicationService, ITrackService
.Where(x => x.TrackTime == input.TrackTime) .Where(x => x.TrackTime == input.TrackTime)
.ToList(); .ToList();
// todo:es落盘延迟是不确定的
//当为更新操作时发现更新的数目为0进行重试操作 //当为更新操作时发现更新的数目为0进行重试操作
if (!input.IsAdd && tracks.Count == 0) if (!input.IsAdd && tracks.Count == 0)
{ {
@ -133,6 +135,7 @@ public partial class TrackService : ApplicationService, ITrackService
.ToList(); .ToList();
if (tracks.Count > 0) if (tracks.Count > 0)
success = true; success = true;
// todo: 最大重试次数应该是可配置的,当出现的时候应该有告警,而不是直接给调用方,指数退避 2^N
await Task.Delay(300); await Task.Delay(300);
} }
finally finally