Repository navigation
DiGi.GIS.WebAPI.UI.HostedServices
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.BackgroundServiceInheritance System.Object → Microsoft.Extensions.Hosting.BackgroundService → SolarJobHostedService
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);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.
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);stoppingToken System.Threading.CancellationToken
Signalled when the application stops; a running calculation cannot be interrupted and finishes first.
System.Threading.Tasks.Task
A task that completes when the application stops.