Fix campaign steps
This commit is contained in:
@ -5,21 +5,32 @@ namespace Hcs.WebApp.BackgroundServices
|
||||
{
|
||||
public class OperationExecutionState
|
||||
{
|
||||
private readonly ConcurrentQueue<Operation> operations = new();
|
||||
private readonly ConcurrentQueue<Operation> operationsInQueue = new();
|
||||
private readonly HashSet<Operation> operationsInProcess = [];
|
||||
|
||||
public void EnqueueOperation(Operation operation)
|
||||
{
|
||||
operations.Enqueue(operation);
|
||||
operationsInQueue.Enqueue(operation);
|
||||
}
|
||||
|
||||
public bool TryDequeueOperation(out Operation operation)
|
||||
{
|
||||
return operations.TryDequeue(out operation);
|
||||
return operationsInQueue.TryDequeue(out operation);
|
||||
}
|
||||
|
||||
public void SetProcessingOperation(Operation operation)
|
||||
{
|
||||
operationsInProcess.Add(operation);
|
||||
}
|
||||
|
||||
public void UnsetProcessingOperation(Operation operation)
|
||||
{
|
||||
operationsInProcess.Remove(operation);
|
||||
}
|
||||
|
||||
public bool HasCampaignOperation(int campaignId)
|
||||
{
|
||||
return operations.Any(x => x.CampaignId == campaignId);
|
||||
return operationsInProcess.Any(x => x.CampaignId == campaignId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user