diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabEventSubscription.cs b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabEventSubscription.cs index 099b9312..17b599b6 100644 --- a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabEventSubscription.cs +++ b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabEventSubscription.cs @@ -21,7 +21,11 @@ public class CrontabEventSubscription : BackgroundService using (var scope = _services.CreateScope()) { - var publisher = scope.ServiceProvider.GetRequiredService(); + var publisher = scope.ServiceProvider.GetService(); + if (publisher == null) + { + return; + } var subscriber = scope.ServiceProvider.GetRequiredService(); var cron = scope.ServiceProvider.GetRequiredService(); var crons = await cron.GetCrontable(); @@ -46,19 +50,5 @@ public class CrontabEventSubscription : BackgroundService }); } } - - - /*using (var scope = _services.CreateScope()) - { - var cron = scope.ServiceProvider.GetRequiredService(); - var crons = await cron.GetCrontable(); - - - - while (!stoppingToken.IsCancellationRequested) - { - await Task.Delay(1000, stoppingToken); - } - }*/ } } diff --git a/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs index 0b1a9c1d..a040525f 100644 --- a/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs +++ b/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs @@ -24,7 +24,7 @@ public class DistributedLocker : IDistributedLocker var redis = _services.GetService(); if (redis == null) { - _logger.LogWarning($"The Redis server is experiencing issues and is not functioning as expected."); + _logger.LogInformation($"The Redis server is experiencing issues and is not functioning as expected."); await action(); return true; }