I have this worker service kicking off jobs but hourly it checks for jobs. How can I get it to check on the hour rather at the run time hourly?
public class WorkerService : BackgroundService
{
private const int generalDelay = 20; //minutes
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
await Task.Delay(generalDelay * 60000, stoppingToken);
await DoBackupAsync();
}
}
private static Task DoBackupAsync()
{
DoWork d = new DoWork();
return Task.FromResult("Done");
}
}
Mainly for this I know when jobs will run and can predict as well as scheduling my updates in between the run times and if all jobs complete.