异步全部await。_tasksQzService不用App.GetRequiredService方法
This commit is contained in:
@@ -56,7 +56,7 @@ namespace ZR.Tasks
|
||||
JobMessage = logMsg
|
||||
};
|
||||
|
||||
RecordTaskLog(context, logModel);
|
||||
await RecordTaskLog(context, logModel);
|
||||
return logModel;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace ZR.Tasks
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="logModel"></param>
|
||||
protected void RecordTaskLog(IJobExecutionContext context, SysTasksLog logModel)
|
||||
protected async Task RecordTaskLog(IJobExecutionContext context, SysTasksLog logModel)
|
||||
{
|
||||
var tasksLogService = (ISysTasksLogService)App.GetRequiredService(typeof(ISysTasksLogService));
|
||||
var taskQzService = (ISysTasksQzService)App.GetRequiredService(typeof(ISysTasksQzService));
|
||||
@@ -74,11 +74,11 @@ namespace ZR.Tasks
|
||||
IJobDetail job = context.JobDetail;
|
||||
|
||||
logModel.InvokeTarget = job.JobType.FullName;
|
||||
logModel = tasksLogService.AddTaskLog(job.Key.Name, logModel);
|
||||
logModel = await tasksLogService.AddTaskLog(job.Key.Name, logModel);
|
||||
//成功后执行次数+1
|
||||
if (logModel.Status == "0")
|
||||
{
|
||||
taskQzService.UpdateAsync(f => new SysTasksQz()
|
||||
await taskQzService.UpdateAsync(f => new SysTasksQz()
|
||||
{
|
||||
RunTimes = f.RunTimes + 1,
|
||||
LastRunTime = DateTime.Now
|
||||
|
||||
Reference in New Issue
Block a user