diff --git a/Hcs.WebApp/BackgroundServices/DataParsingService.cs b/Hcs.WebApp/BackgroundServices/DataParsingService.cs index 077b9cf..c7ce20c 100644 --- a/Hcs.WebApp/BackgroundServices/DataParsingService.cs +++ b/Hcs.WebApp/BackgroundServices/DataParsingService.cs @@ -22,7 +22,7 @@ namespace Hcs.WebApp.BackgroundServices using var scope = scopeFactory.CreateScope(); var headquartersService = scope.ServiceProvider.GetRequiredService(); - var operations = await headquartersService.GetResultWaitingOperationsAsync(); + var operations = await headquartersService.GetNotCompletedParseOperationsAsync(); foreach (var operation in operations) { state.EnqueueOperation(operation); diff --git a/Hcs.WebApp/BackgroundServices/OperationExecutionService.cs b/Hcs.WebApp/BackgroundServices/OperationExecutionService.cs index f26115f..e5baa22 100644 --- a/Hcs.WebApp/BackgroundServices/OperationExecutionService.cs +++ b/Hcs.WebApp/BackgroundServices/OperationExecutionService.cs @@ -75,7 +75,7 @@ namespace Hcs.WebApp.BackgroundServices using var scope = scopeFactory.CreateScope(); var headquartersService = scope.ServiceProvider.GetRequiredService(); - var operations = await headquartersService.GetNotExecutedOperationsAsync(); + var operations = await headquartersService.GetNotExecutedRemoteOperationsAsync(); foreach (var operation in operations) { state.EnqueueOperation(operation); diff --git a/Hcs.WebApp/BackgroundServices/ResultGetService.cs b/Hcs.WebApp/BackgroundServices/ResultGetService.cs index 4182b65..de2d83b 100644 --- a/Hcs.WebApp/BackgroundServices/ResultGetService.cs +++ b/Hcs.WebApp/BackgroundServices/ResultGetService.cs @@ -118,7 +118,7 @@ namespace Hcs.WebApp.BackgroundServices using var scope = scopeFactory.CreateScope(); var headquartersService = scope.ServiceProvider.GetRequiredService(); - var operations = await headquartersService.GetResultWaitingOperationsAsync(); + var operations = await headquartersService.GetResultWaitingRemoteOperationsAsync(); foreach (var operation in operations) { state.EnqueueOperation(operation); diff --git a/Hcs.WebApp/Services/HeadquartersService.cs b/Hcs.WebApp/Services/HeadquartersService.cs index d218ad8..11e9d6c 100644 --- a/Hcs.WebApp/Services/HeadquartersService.cs +++ b/Hcs.WebApp/Services/HeadquartersService.cs @@ -25,20 +25,34 @@ namespace Hcs.WebApp.Services select campaign).ToListAsync(); } - public async Task> GetNotExecutedOperationsAsync() + public async Task> GetNotExecutedRemoteOperationsAsync() { using var context = GetNewContext(); - return await (from operation in context.Operations - where string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue - select operation).ToListAsync(); + var query = from operation in context.Operations + where string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue + select operation; + var result = await query.ToListAsync(); + return result.Where(x => x.Kind == Operation.OperationKind.Remote); } - public async Task> GetResultWaitingOperationsAsync() + public async Task> GetResultWaitingRemoteOperationsAsync() { using var context = GetNewContext(); - return await (from operation in context.Operations - where !string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue - select operation).ToListAsync(); + var query = from operation in context.Operations + where !string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue + select operation; + var result = await query.ToListAsync(); + return result.Where(x => x.Kind == Operation.OperationKind.Remote); + } + + public async Task> GetNotCompletedParseOperationsAsync() + { + using var context = GetNewContext(); + var query = from operation in context.Operations + where !operation.EndedAt.HasValue + select operation; + var result = await query.ToListAsync(); + return result.Where(x => x.Kind == Operation.OperationKind.Parse); } public async Task> GetOperationsAsync()