From 86f19c9724da0b664f0a62e29417cef7295fd5db Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Tue, 29 Oct 2024 10:35:23 -0500 Subject: [PATCH] Use stopping token --- src/Foundatio.Extensions.Hosting/Jobs/ScheduledJobService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Foundatio.Extensions.Hosting/Jobs/ScheduledJobService.cs b/src/Foundatio.Extensions.Hosting/Jobs/ScheduledJobService.cs index d1a3dca7..3e8c3738 100644 --- a/src/Foundatio.Extensions.Hosting/Jobs/ScheduledJobService.cs +++ b/src/Foundatio.Extensions.Hosting/Jobs/ScheduledJobService.cs @@ -35,12 +35,12 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) } // delay until right after next minute starts to sync with cron schedules - await Task.Delay(TimeSpan.FromSeconds(60 - _timeProvider.GetUtcNow().UtcDateTime.Second)); + await Task.Delay(TimeSpan.FromSeconds(60 - _timeProvider.GetUtcNow().UtcDateTime.Second), stoppingToken); while (!stoppingToken.IsCancellationRequested) { var jobsToRun = new List(); - using (var activity = FoundatioDiagnostics.ActivitySource.StartActivity("Job Scheduler")) + using (FoundatioDiagnostics.ActivitySource.StartActivity("Job Scheduler")) { foreach (var job in _jobManager.Jobs) if (await job.ShouldRunAsync())