From 39c0f8a6f7b92ed182333cf62c1188e5c9a4697a Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Fri, 20 Sep 2024 16:52:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=E3=80=90=E3=80=90test=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E3=80=91=E5=BD=93=E5=89=8D=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E8=B6=85=E8=BF=87=E4=BA=86=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E7=8A=B6=E6=80=81=E6=9C=AA=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E4=B8=BA=E6=8B=89=E5=8F=96=E4=B8=AD=E3=80=91=20=20=20=20https:?= =?UTF-8?q?//www.tapd.cn/60863849/bugtrace/bugs/view/1160863849001049248?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrderPullStatusScanner.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/SJZY.Track.Application/BackgroundServices/OrderPullStatusScanner.cs b/src/SJZY.Track.Application/BackgroundServices/OrderPullStatusScanner.cs index e2fb7bd0..6875fd82 100644 --- a/src/SJZY.Track.Application/BackgroundServices/OrderPullStatusScanner.cs +++ b/src/SJZY.Track.Application/BackgroundServices/OrderPullStatusScanner.cs @@ -23,14 +23,17 @@ public class OrderPullStatusScanner : BackgroundService protected override async Task ExecuteAsync(CancellationToken stoppingToken) { - var stopwatch = Stopwatch.StartNew(); - var count1 = await _orderRepository.UpdatePullStatusBySilenceAsync(); - // real del - var count2 = await _orderRepository.ClearPullStatusAsync(); - stopwatch.Stop(); - LogHelper.Info( - $"{nameof(OrderPullStatusScanner)}本次扫描更新了{count1}条,删除了{count2}条订单拉取状态,耗时{stopwatch.ElapsedMilliseconds}ms"); + while (true) + { + await Task.Delay(TimeSpan.FromSeconds(_options.CurrentValue.OrderPullStatusScanInterval), stoppingToken); - await Task.Delay(TimeSpan.FromSeconds(_options.CurrentValue.OrderPullStatusScanInterval), stoppingToken); + var stopwatch = Stopwatch.StartNew(); + var count1 = await _orderRepository.UpdatePullStatusBySilenceAsync(); + // real del + var count2 = await _orderRepository.ClearPullStatusAsync(); + stopwatch.Stop(); + LogHelper.Info( + $"{nameof(OrderPullStatusScanner)}本次扫描更新了{count1}条,删除了{count2}条订单拉取状态,耗时{stopwatch.ElapsedMilliseconds}ms"); + } } }