Jelajahi Sumber

修复ETaskType.Delay任务未执行的逻辑问题

在ApptaskJob的Execute方法中:
- 新增变量executor,用于接收服务实例。
- 调用_apptaskDomainService.ExecuteAsync,传入executor、task和CancellationToken,完善任务执行逻辑。
- 删除无用的注释代码,优化代码可读性。
xf 3 minggu lalu
induk
melakukan
4442061f90
1 mengubah file dengan 2 tambahan dan 3 penghapusan
  1. 2 3
      src/Hotline.Application/Jobs/ApptaskJob.cs

+ 2 - 3
src/Hotline.Application/Jobs/ApptaskJob.cs

@@ -22,11 +22,11 @@ namespace Hotline.Application.Jobs
         {
             var task = await _apptaskDomainService.GetWaitingTaskAsync(context.CancellationToken);
             if (task is null) return;
-            //create executor by task type
             switch (task.TaskType)
             {
                 case ETaskType.Delay:
-                     _serviceProvider.GetService<IApptaskExecutor<BatchDelayNextFlowDto>>();
+                    var executor = _serviceProvider.GetService<IApptaskExecutor<BatchDelayNextFlowDto>>();
+                    await _apptaskDomainService.ExecuteAsync(executor, task, context.CancellationToken);
                     break;
                 case ETaskType.Screen:
                     break;
@@ -34,7 +34,6 @@ namespace Hotline.Application.Jobs
                     throw new ArgumentOutOfRangeException();
             }
             
-            //await _apptaskDomainService.ExecuteAsync(new OrderDelayAuditTaskExecutor(), task, context.CancellationToken);
         }
 
         /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>