< Summary

Information
Class: Elsa.Workflows.Runtime.Distributed.DistributedBookmarkQueueWorker
Assembly: Elsa.Workflows.Runtime.Distributed
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedBookmarkQueueWorker.cs
Line coverage
80%
Covered lines: 8
Uncovered lines: 2
Coverable lines: 10
Total lines: 29
Line coverage: 80%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.cctor()100%11100%
ProcessAsync()100%2275%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedBookmarkQueueWorker.cs

#LineLine coverage
 1using Medallion.Threading;
 2using Microsoft.Extensions.DependencyInjection;
 3using Microsoft.Extensions.Logging;
 4
 5namespace Elsa.Workflows.Runtime.Distributed;
 6
 7public class DistributedBookmarkQueueWorker(
 8    IDistributedLockProvider distributedLockProvider,
 9    IBookmarkQueueSignaler signaler,
 10    IServiceScopeFactory scopeFactory,
 211    ILogger<DistributedBookmarkQueueWorker> logger) : BookmarkQueueWorker(signaler, scopeFactory, logger)
 12{
 113    private static readonly TimeSpan LockRetryDelay = TimeSpan.FromSeconds(2);
 14
 15    protected override async Task ProcessAsync(CancellationToken cancellationToken)
 16    {
 417        await using var handle = await distributedLockProvider.TryAcquireLockAsync(nameof(DistributedBookmarkQueueWorker
 18
 319        if (handle == null)
 20        {
 121            logger.LogDebug("Could not acquire lock for distributed bookmark queue worker. Another application instance 
 122            await Task.Delay(LockRetryDelay, cancellationToken);
 023            await Signaler.TriggerAsync(cancellationToken);
 024            return;
 25        }
 26
 227        await base.ProcessAsync(cancellationToken);
 228    }
 29}