• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ImmediatePlatform / Immediate.Jobs / 30300691995

27 Jul 2026 08:00PM UTC coverage: 64.845%. First build
30300691995

Pull #20

github

web-flow
Merge a73d5f4ed into e8a73c280
Pull Request #20: Initial draft

1300 of 1892 new or added lines in 29 files covered. (68.71%)

1649 of 2543 relevant lines covered (64.84%)

2.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.36
/src/Immediate.Jobs.Shared/ServiceCollectionExtensions.cs
1
using Microsoft.Extensions.DependencyInjection.Extensions;
2
using Microsoft.Extensions.Diagnostics.HealthChecks;
3
using Microsoft.Extensions.Hosting;
4

5
#pragma warning disable IDE0130 // Extension methods intentionally follow the namespace of the extended type.
6
namespace Microsoft.Extensions.DependencyInjection;
7
#pragma warning restore IDE0130
8

9
/// <summary>Runtime registration methods used by generated application extensions.</summary>
10
public static class ImmediateJobsRuntimeServiceCollectionExtensions
11
{
12
        /// <summary>Adds the scheduler runtime. Application code normally calls generated AddImmediateJobs instead.</summary>
13
        public static Immediate.Jobs.Shared.ImmediateJobsBuilder AddImmediateJobsCore(
14
                this IServiceCollection services,
15
                Action<Immediate.Jobs.Shared.ImmediateJobsOptions>? configure = null
16
        )
17
        {
18
                ArgumentNullException.ThrowIfNull(services);
4✔
19

20
                var options = new Immediate.Jobs.Shared.ImmediateJobsOptions();
4✔
21
                configure?.Invoke(options);
4✔
22
                if (options.StorageFactory is null)
4✔
23
                {
24
                        if (options.StorageModeExplicitlySelected)
4✔
25
                                throw new InvalidOperationException("Select a durable storage provider before choosing single-server or distributed mode.");
4✔
26

27
                        _ = options.UseInMemory();
4✔
28
                }
29

30
                options.Validate();
4✔
31

32
                services.TryAddSingleton(options);
4✔
33
                services.TryAddSingleton(TimeProvider.System);
4✔
34
                services.TryAddSingleton<Immediate.Jobs.Shared.IJobSerializer, Immediate.Jobs.Shared.SystemTextJsonJobSerializer>();
4✔
35
                services.TryAddSingleton<Immediate.Jobs.Shared.IJobStorage>(sp => options.CreateStorage(sp));
4✔
36
                _ = services.AddSingleton(Immediate.Jobs.Shared.JobQueueDefinition.Default);
4✔
37
                services.TryAddSingleton<Immediate.Jobs.Shared.JobSchedulerState>();
4✔
38
                services.TryAddSingleton<Immediate.Jobs.Shared.JobSchedulerService>();
4✔
39
                _ = services.AddSingleton<IHostedService>(
4✔
40
                        static sp => sp.GetRequiredService<Immediate.Jobs.Shared.JobSchedulerService>()
4✔
41
                );
4✔
42
                return new(services);
4✔
43
        }
44

45
        /// <summary>Adds scheduler liveness and storage connectivity to the health-check system.</summary>
46
        public static Immediate.Jobs.Shared.ImmediateJobsBuilder AddHealthCheck(
47
                this Immediate.Jobs.Shared.ImmediateJobsBuilder builder,
48
                string name = "immediate-jobs",
49
                HealthStatus? failureStatus = null,
50
                IEnumerable<string>? tags = null
51
        )
52
        {
NEW
53
                ArgumentNullException.ThrowIfNull(builder);
×
NEW
54
                _ = builder.Services.AddHealthChecks().AddCheck<Immediate.Jobs.Shared.ImmediateJobsHealthCheck>(name, failureStatus, tags ?? []);
×
NEW
55
                return builder;
×
56
        }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc