Wait other states in campaign management service
This commit is contained in:
@ -8,6 +8,8 @@ namespace Hcs.WebApp.BackgroundServices
|
||||
private readonly ConcurrentQueue<Operation> operationsInQueue = new();
|
||||
private readonly HashSet<Operation> operationsInProcess = [];
|
||||
|
||||
public bool Ready { get; set; }
|
||||
|
||||
public void EnqueueOperation(Operation operation)
|
||||
{
|
||||
operationsInQueue.Enqueue(operation);
|
||||
@ -30,7 +32,7 @@ namespace Hcs.WebApp.BackgroundServices
|
||||
|
||||
public bool HasCampaignOperation(int campaignId)
|
||||
{
|
||||
return operationsInProcess.Any(x => x.CampaignId == campaignId);
|
||||
return operationsInQueue.Any(x => x.CampaignId == campaignId) || operationsInProcess.Any(x => x.CampaignId == campaignId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user