test(workers): prove clock and restart safety
This commit is contained in:
@@ -11,7 +11,8 @@ public sealed class JobEnrichmentHostedService(
|
||||
BackgroundTenantRunner tenants,
|
||||
IConfiguration configuration,
|
||||
ILogger<JobEnrichmentHostedService> logger,
|
||||
IStartupReadiness startupReadiness) : BackgroundService
|
||||
IStartupReadiness startupReadiness,
|
||||
TimeProvider timeProvider) : BackgroundService
|
||||
{
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
@@ -22,11 +23,11 @@ public sealed class JobEnrichmentHostedService(
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
|
||||
await Task.Delay(TimeSpan.FromSeconds(10), timeProvider, stoppingToken);
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
await RunOnceAsync(stoppingToken);
|
||||
await Task.Delay(TimeSpan.FromMinutes(10), stoppingToken);
|
||||
await Task.Delay(TimeSpan.FromMinutes(10), timeProvider, stoppingToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user