fix: 批量任务系统失败重新抛异常以触发 EventBus 重试

Restore InvalidOperationException on system failures after EventBus refactor; use OrderTaskStatusCodes when syncing import tasks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-07-21 17:38:03 +08:00
parent 365f9d8a94
commit dcf856568e

View File

@ -110,7 +110,11 @@ public sealed class OrderBatchJobProcessor(
}
await RefreshJobSummaryAsync(item.JobId, cancellationToken);
return;
}
// 系统失败:抛出让 EventBus 重试,耗尽后进 DLX
throw new InvalidOperationException(result.FailReason ?? "批量任务系统失败");
}
private async Task RefreshJobSummaryAsync(int jobId, CancellationToken cancellationToken)
@ -169,11 +173,11 @@ public sealed class OrderBatchJobProcessor(
if (job.Status is OrderBatchJobStatusCodes.Completed or OrderBatchJobStatusCodes.Failed)
{
task.Status = "completed";
task.Status = OrderTaskStatusCodes.Completed;
}
else if (job.Status == OrderBatchJobStatusCodes.Running)
{
task.Status = "processing";
task.Status = OrderTaskStatusCodes.Processing;
}
await orderTaskRepository.UpdateAsync(task, cancellationToken: cancellationToken);