Skip to content

DiGi.GIS.WebAPI.UI.HostedServices

github-actions[bot] edited this page Sep 28, 2026 · 1 revision

DiGi.GIS.WebAPI.UI.HostedServices Namespace

Classes

SolarJobHostedService Class

The single consumer of the background solar radiation jobs (SolarJobQueue): runs them one after the other, in the order they were queued, behind the solve gate it shares with the synchronous requests of SolarController (DiGi.GIS.WebAPI.UI#60).

A framework type, like a controller: ASP.NET Core runs a background loop only through Microsoft.Extensions.Hosting.BackgroundService. It holds the loop and nothing else; the job logic is Modify.SolveAsync. The consumer runs on this host, the web server: see Coding - Deployed WebAPI.md section 5 and the decision recorded on DiGi.GIS.WebAPI.UI#60.

public class SolarJobHostedService : Microsoft.Extensions.Hosting.BackgroundService

Inheritance System.Object → Microsoft.Extensions.Hosting.BackgroundService → SolarJobHostedService

Constructors

SolarJobHostedService(SolarJobQueue, SemaphoreSlim, ILogger<SolarJobHostedService>) Constructor

Initializes a new instance of the SolarJobHostedService class.

public SolarJobHostedService(DiGi.GIS.WebAPI.UI.Classes.SolarJobQueue solarJobQueue, System.Threading.SemaphoreSlim semaphoreSlim, Microsoft.Extensions.Logging.ILogger<DiGi.GIS.WebAPI.UI.HostedServices.SolarJobHostedService> logger);

Parameters

solarJobQueue SolarJobQueue

The queue of jobs to consume.

semaphoreSlim System.Threading.SemaphoreSlim

The gate shared by every solar radiation solve on this host, registered under SolarSolveGateKey.

logger Microsoft.Extensions.Logging.ILogger<SolarJobHostedService>

The logger receiving one line per job.

Methods

SolarJobHostedService.ExecuteAsync(CancellationToken) Method

Runs every queued job, one at a time, until the application stops. A failure of one job is logged and never ends the loop: an exception escaping here would stop the whole application.

protected override System.Threading.Tasks.Task ExecuteAsync(System.Threading.CancellationToken stoppingToken);

Parameters

stoppingToken System.Threading.CancellationToken

Signalled when the application stops; a running calculation cannot be interrupted and finishes first.

Returns

System.Threading.Tasks.Task
A task that completes when the application stops.

Clone this wiki locally