Add result wait service
This commit is contained in:
25
Hcs.WebApp/BackgroundServices/ResultWaitState.cs
Normal file
25
Hcs.WebApp/BackgroundServices/ResultWaitState.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Hcs.WebApp.Data.Hcs;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Hcs.WebApp.BackgroundServices
|
||||
{
|
||||
public class ResultWaitState
|
||||
{
|
||||
private readonly ConcurrentQueue<Operation> operations = new();
|
||||
|
||||
public void EnqueueOperation(Operation operation)
|
||||
{
|
||||
operations.Enqueue(operation);
|
||||
}
|
||||
|
||||
public bool TryDequeueOperation(out Operation operation)
|
||||
{
|
||||
return operations.TryDequeue(out operation);
|
||||
}
|
||||
|
||||
public bool HasCampaignOperation(int campaignId)
|
||||
{
|
||||
return operations.Any(x => x.CampaignId == campaignId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user