8ac593d36f
Backend CI / build-and-test (push) Failing after 14m19s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 12m5s
Frontend CI / build-and-check (push) Failing after 17m58s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 10m11s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 11m3s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m58s
22 lines
683 B
C#
22 lines
683 B
C#
using System.Threading.Channels;
|
|
using UniVerse.Application.Interfaces;
|
|
|
|
namespace UniVerse.Api.BackgroundServices;
|
|
|
|
public sealed class ReviewAnalysisQueue : IReviewAnalysisQueue
|
|
{
|
|
private readonly Channel<int> _channel = Channel.CreateUnbounded<int>(new UnboundedChannelOptions
|
|
{
|
|
SingleReader = false,
|
|
SingleWriter = false
|
|
});
|
|
|
|
public async Task EnqueueAsync(int reviewId, CancellationToken cancellationToken = default)
|
|
{
|
|
await _channel.Writer.WriteAsync(reviewId, cancellationToken);
|
|
}
|
|
|
|
public IAsyncEnumerable<int> ReadAllAsync(CancellationToken cancellationToken) =>
|
|
_channel.Reader.ReadAllAsync(cancellationToken);
|
|
}
|