Merge pull request #1187 from adenchen123/master
Delay one second inside LockAsync in crontab watcher
This commit is contained in:
commit
c09214fefc
|
|
@ -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