< Summary

Information
Class: Elsa.Common.Multitenancy.TenantBackgroundWorkQueue
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Multitenancy/Implementations/TenantBackgroundWorkQueue.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 23
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
EnqueueAsync(...)100%11100%
DequeueAllAsync(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Multitenancy/Implementations/TenantBackgroundWorkQueue.cs

#LineLine coverage
 1using System.Threading.Channels;
 2
 3namespace Elsa.Common.Multitenancy;
 4
 5public class TenantBackgroundWorkQueue : ITenantBackgroundWorkQueue
 6{
 137    private readonly Channel<TenantBackgroundWorkItem> _channel = Channel.CreateUnbounded<TenantBackgroundWorkItem>(new 
 138    {
 139        SingleReader = true,
 1310        SingleWriter = false
 1311    });
 12
 13    public ValueTask EnqueueAsync(TenantBackgroundWorkItem workItem, CancellationToken cancellationToken = default)
 14    {
 1315        ArgumentNullException.ThrowIfNull(workItem);
 1316        return _channel.Writer.WriteAsync(workItem, cancellationToken);
 17    }
 18
 19    public IAsyncEnumerable<TenantBackgroundWorkItem> DequeueAllAsync(CancellationToken cancellationToken = default)
 20    {
 1321        return _channel.Reader.ReadAllAsync(cancellationToken);
 22    }
 23}