Use operations kind
This commit is contained in:
@ -22,7 +22,7 @@ namespace Hcs.WebApp.BackgroundServices
|
|||||||
using var scope = scopeFactory.CreateScope();
|
using var scope = scopeFactory.CreateScope();
|
||||||
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
|
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
|
||||||
|
|
||||||
var operations = await headquartersService.GetResultWaitingOperationsAsync();
|
var operations = await headquartersService.GetNotCompletedParseOperationsAsync();
|
||||||
foreach (var operation in operations)
|
foreach (var operation in operations)
|
||||||
{
|
{
|
||||||
state.EnqueueOperation(operation);
|
state.EnqueueOperation(operation);
|
||||||
|
|||||||
@ -75,7 +75,7 @@ namespace Hcs.WebApp.BackgroundServices
|
|||||||
using var scope = scopeFactory.CreateScope();
|
using var scope = scopeFactory.CreateScope();
|
||||||
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
|
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
|
||||||
|
|
||||||
var operations = await headquartersService.GetNotExecutedOperationsAsync();
|
var operations = await headquartersService.GetNotExecutedRemoteOperationsAsync();
|
||||||
foreach (var operation in operations)
|
foreach (var operation in operations)
|
||||||
{
|
{
|
||||||
state.EnqueueOperation(operation);
|
state.EnqueueOperation(operation);
|
||||||
|
|||||||
@ -118,7 +118,7 @@ namespace Hcs.WebApp.BackgroundServices
|
|||||||
using var scope = scopeFactory.CreateScope();
|
using var scope = scopeFactory.CreateScope();
|
||||||
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
|
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
|
||||||
|
|
||||||
var operations = await headquartersService.GetResultWaitingOperationsAsync();
|
var operations = await headquartersService.GetResultWaitingRemoteOperationsAsync();
|
||||||
foreach (var operation in operations)
|
foreach (var operation in operations)
|
||||||
{
|
{
|
||||||
state.EnqueueOperation(operation);
|
state.EnqueueOperation(operation);
|
||||||
|
|||||||
@ -25,20 +25,34 @@ namespace Hcs.WebApp.Services
|
|||||||
select campaign).ToListAsync();
|
select campaign).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<Operation>> GetNotExecutedOperationsAsync()
|
public async Task<IEnumerable<Operation>> GetNotExecutedRemoteOperationsAsync()
|
||||||
{
|
{
|
||||||
using var context = GetNewContext();
|
using var context = GetNewContext();
|
||||||
return await (from operation in context.Operations
|
var query = from operation in context.Operations
|
||||||
where string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue
|
where string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue
|
||||||
select operation).ToListAsync();
|
select operation;
|
||||||
|
var result = await query.ToListAsync();
|
||||||
|
return result.Where(x => x.Kind == Operation.OperationKind.Remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<Operation>> GetResultWaitingOperationsAsync()
|
public async Task<IEnumerable<Operation>> GetResultWaitingRemoteOperationsAsync()
|
||||||
{
|
{
|
||||||
using var context = GetNewContext();
|
using var context = GetNewContext();
|
||||||
return await (from operation in context.Operations
|
var query = from operation in context.Operations
|
||||||
where !string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue
|
where !string.IsNullOrEmpty(operation.MessageGuid) && !operation.EndedAt.HasValue
|
||||||
select operation).ToListAsync();
|
select operation;
|
||||||
|
var result = await query.ToListAsync();
|
||||||
|
return result.Where(x => x.Kind == Operation.OperationKind.Remote);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Operation>> 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<ICollection<Operation>> GetOperationsAsync()
|
public async Task<ICollection<Operation>> GetOperationsAsync()
|
||||||
|
|||||||
Reference in New Issue
Block a user