From 4957e4e8458fd4349f550fa07602b4d6920097fd Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:07:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(tasks):=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=E9=9C=80=E8=A6=81=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=99=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Abp/TaskManagement/BackgroundJobStore.cs | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobStore.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobStore.cs index 89d565877..280dc48d7 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobStore.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/BackgroundJobStore.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; @@ -14,20 +13,17 @@ namespace LINGYUN.Abp.TaskManagement; [Dependency(ReplaceServices = true)] public class BackgroundJobStore : IJobStore, ITransientDependency { - protected IDataFilter DataFilter { get; } protected IObjectMapper ObjectMapper { get; } protected ICurrentTenant CurrentTenant { get; } protected IBackgroundJobInfoRepository JobInfoRepository { get; } protected IBackgroundJobLogRepository JobLogRepository { get; } public BackgroundJobStore( - IDataFilter dataFilter, IObjectMapper objectMapper, ICurrentTenant currentTenant, IBackgroundJobInfoRepository jobInfoRepository, IBackgroundJobLogRepository jobLogRepository) { - DataFilter = dataFilter; ObjectMapper = objectMapper; CurrentTenant = currentTenant; JobInfoRepository = jobInfoRepository; @@ -36,22 +32,16 @@ public class BackgroundJobStore : IJobStore, ITransientDependency public async virtual Task> GetAllPeriodTasksAsync(CancellationToken cancellationToken = default) { - using (DataFilter.Disable()) - { - var jobInfos = await JobInfoRepository.GetAllPeriodTasksAsync(cancellationToken); + var jobInfos = await JobInfoRepository.GetAllPeriodTasksAsync(cancellationToken); - return ObjectMapper.Map, List>(jobInfos); - } + return ObjectMapper.Map, List>(jobInfos); } public async virtual Task> GetWaitingListAsync(int maxResultCount, CancellationToken cancellationToken = default) { - using (DataFilter.Disable()) - { - var jobInfos = await JobInfoRepository.GetWaitingListAsync(maxResultCount, cancellationToken); + var jobInfos = await JobInfoRepository.GetWaitingListAsync(maxResultCount, cancellationToken); - return ObjectMapper.Map, List>(jobInfos); - } + return ObjectMapper.Map, List>(jobInfos); } public async virtual Task FindAsync(Guid jobId) @@ -151,14 +141,11 @@ public class BackgroundJobStore : IJobStore, ITransientDependency TimeSpan jobExpiratime, CancellationToken cancellationToken = default) { - using (DataFilter.Disable()) - { - var jobs = await JobInfoRepository.GetExpiredJobsAsync( + var jobs = await JobInfoRepository.GetExpiredJobsAsync( maxResultCount, jobExpiratime, cancellationToken); - await JobInfoRepository.DeleteManyAsync(jobs, cancellationToken: cancellationToken); - } + await JobInfoRepository.DeleteManyAsync(jobs, cancellationToken: cancellationToken); } }