Delay one second inside LockAsync
This commit is contained in:
parent
b8636a7c40
commit
79c6bf7fd3
|
|
@ -31,14 +31,11 @@ public class CrontabWatcher : BackgroundService
|
||||||
|
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
var delay = Task.Delay(1000, stoppingToken);
|
|
||||||
|
|
||||||
await locker.LockAsync(DIST_KEY, async () =>
|
await locker.LockAsync(DIST_KEY, async () =>
|
||||||
{
|
{
|
||||||
await RunCronChecker(scope.ServiceProvider);
|
await RunCronChecker(scope.ServiceProvider);
|
||||||
|
await Task.Delay(1000, stoppingToken);
|
||||||
});
|
});
|
||||||
|
|
||||||
await delay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogWarning("Crontab Watcher background service is stopped.");
|
_logger.LogWarning("Crontab Watcher background service is stopped.");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue