diff --git a/src/modules/retention/Elsa.Retention/HostedServices/CleanupService.cs b/src/modules/retention/Elsa.Retention/HostedServices/CleanupService.cs index e8164d139..d2ce1f769 100644 --- a/src/modules/retention/Elsa.Retention/HostedServices/CleanupService.cs +++ b/src/modules/retention/Elsa.Retention/HostedServices/CleanupService.cs @@ -38,7 +38,10 @@ namespace Elsa.Retention.HostedServices { await Task.Delay(_interval, stoppingToken); await using var handle = await _distributedLockProvider.AcquireLockAsync(nameof(CleanupService), cancellationToken: stoppingToken); - + + if (handle == null) + continue; + try { await job.ExecuteAsync(stoppingToken);