< Summary

Information
Class: Elsa.Scheduling.HostedServices.CreateSchedulesBackgroundTask
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/HostedServices/CreateSchedulesBackgroundTask.cs
Line coverage
100%
Covered lines: 18
Uncovered lines: 0
Coverable lines: 18
Total lines: 35
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%
ExecuteAsync()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/HostedServices/CreateSchedulesBackgroundTask.cs

#LineLine coverage
 1using Elsa.Common;
 2using Elsa.Workflows.Runtime;
 3using Elsa.Workflows.Runtime.Filters;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Scheduling.HostedServices;
 7
 8/// <summary>
 9/// Creates new schedules when using the default scheduler (which doesn't have its own persistence layer like Quartz or 
 10/// </summary>
 11[UsedImplicitly]
 112public class CreateSchedulesBackgroundTask(ITriggerStore triggerStore, IBookmarkStore bookmarkStore, ITriggerScheduler t
 13{
 14    /// <inheritdoc />
 15    public override async Task ExecuteAsync(CancellationToken stoppingToken)
 16    {
 117        var stimulusNames = new[]
 118        {
 119            SchedulingStimulusNames.Cron, SchedulingStimulusNames.Timer, SchedulingStimulusNames.StartAt, SchedulingStim
 120        };
 121        var triggerFilter = new TriggerFilter
 122        {
 123            Names = stimulusNames
 124        };
 125        var bookmarkFilter = new BookmarkFilter
 126        {
 127            Names = stimulusNames
 128        };
 129        var triggers = (await triggerStore.FindManyAsync(triggerFilter, stoppingToken)).ToList();
 130        var bookmarks = (await bookmarkStore.FindManyAsync(bookmarkFilter, stoppingToken)).ToList();
 31
 132        await triggerScheduler.ScheduleAsync(triggers, stoppingToken);
 133        await bookmarkScheduler.ScheduleAsync(bookmarks, stoppingToken);
 134    }
 35}