fix
This commit is contained in:
parent
4dc8849b31
commit
cc251f7129
146 changed files with 2465 additions and 4785 deletions
22
Services/ImportJobQueue.cs
Normal file
22
Services/ImportJobQueue.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System.Threading.Channels;
|
||||
|
||||
namespace BMA.EHR.Recruit.Services;
|
||||
|
||||
public class ImportJobQueue
|
||||
{
|
||||
private readonly Channel<ImportJobInfo> _channel = Channel.CreateBounded<ImportJobInfo>(new BoundedChannelOptions(100)
|
||||
{
|
||||
FullMode = BoundedChannelFullMode.Wait,
|
||||
SingleReader = true
|
||||
});
|
||||
|
||||
public async ValueTask EnqueueAsync(ImportJobInfo job, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await _channel.Writer.WriteAsync(job, cancellationToken);
|
||||
}
|
||||
|
||||
public async ValueTask<ImportJobInfo> DequeueAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return await _channel.Reader.ReadAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue