浏览代码

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

在ApptaskJob的Execute方法中:
- 新增变量executor,用于接收服务实例。
- 调用_apptaskDomainService.ExecuteAsync,传入executor、task和CancellationToken,完善任务执行逻辑。
- 删除无用的注释代码,优化代码可读性。
xf 3 周之前
父节点
当前提交
4442061f90
共有 1 个文件被更改,包括 2 次插入3 次删除
  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);
             var task = await _apptaskDomainService.GetWaitingTaskAsync(context.CancellationToken);
             if (task is null) return;
             if (task is null) return;
-            //create executor by task type
             switch (task.TaskType)
             switch (task.TaskType)
             {
             {
                 case ETaskType.Delay:
                 case ETaskType.Delay:
-                     _serviceProvider.GetService<IApptaskExecutor<BatchDelayNextFlowDto>>();
+                    var executor = _serviceProvider.GetService<IApptaskExecutor<BatchDelayNextFlowDto>>();
+                    await _apptaskDomainService.ExecuteAsync(executor, task, context.CancellationToken);
                     break;
                     break;
                 case ETaskType.Screen:
                 case ETaskType.Screen:
                     break;
                     break;
@@ -34,7 +34,6 @@ namespace Hotline.Application.Jobs
                     throw new ArgumentOutOfRangeException();
                     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>
         /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>