remove redis dependency from CrontabEventSubscription

This commit is contained in:
Haiping Chen 2025-01-29 06:45:49 -06:00
parent 15a30f2670
commit aef830deba
2 changed files with 6 additions and 16 deletions

View file

@ -21,7 +21,11 @@ public class CrontabEventSubscription : BackgroundService
using (var scope = _services.CreateScope())
{
var publisher = scope.ServiceProvider.GetRequiredService<IEventPublisher>();
var publisher = scope.ServiceProvider.GetService<IEventPublisher>();
if (publisher == null)
{
return;
}
var subscriber = scope.ServiceProvider.GetRequiredService<IEventSubscriber>();
var cron = scope.ServiceProvider.GetRequiredService<ICrontabService>();
var crons = await cron.GetCrontable();
@ -46,19 +50,5 @@ public class CrontabEventSubscription : BackgroundService
});
}
}
/*using (var scope = _services.CreateScope())
{
var cron = scope.ServiceProvider.GetRequiredService<ICrontabService>();
var crons = await cron.GetCrontable();
while (!stoppingToken.IsCancellationRequested)
{
await Task.Delay(1000, stoppingToken);
}
}*/
}
}

View file

@ -24,7 +24,7 @@ public class DistributedLocker : IDistributedLocker
var redis = _services.GetService<IConnectionMultiplexer>();
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;
}