From 1184528d70fcf5968665d7809d43d2caf636ae1f Mon Sep 17 00:00:00 2001 From: "aden.chen" Date: Wed, 15 Oct 2025 10:20:28 +0800 Subject: [PATCH 1/3] Handling redis timeout in RedisSubscriber --- .../BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs index 61db1d33b..a09224d87 100644 --- a/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs +++ b/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs @@ -81,6 +81,10 @@ public async Task SubscribeAsync(string channel, string group, int? port, bool p await HandleGroupMessage(db, channel, group, consumer, received, $"{channel}-Error"); } } + catch (RedisTimeoutException) + { + _logger.LogWarning($"Redis timeout for channel {channel}, will retry in next cycle"); + } catch (Exception ex) { _logger.LogError($"Error processing message: {ex.Message}\r\n{ex}"); From b8636a7c40cb2f92e1f63a8de0a2cd0095236537 Mon Sep 17 00:00:00 2001 From: "aden.chen" Date: Wed, 15 Oct 2025 14:25:44 +0800 Subject: [PATCH 2/3] Revert "Handling redis timeout in RedisSubscriber" This reverts commit 1184528d70fcf5968665d7809d43d2caf636ae1f. --- .../BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs index a09224d87..61db1d33b 100644 --- a/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs +++ b/src/Infrastructure/BotSharp.Core/Infrastructures/Events/RedisSubscriber.cs @@ -81,10 +81,6 @@ public async Task SubscribeAsync(string channel, string group, int? port, bool p await HandleGroupMessage(db, channel, group, consumer, received, $"{channel}-Error"); } } - catch (RedisTimeoutException) - { - _logger.LogWarning($"Redis timeout for channel {channel}, will retry in next cycle"); - } catch (Exception ex) { _logger.LogError($"Error processing message: {ex.Message}\r\n{ex}"); From 79c6bf7fd3c03e4bb31397c5a595ae25a77298f1 Mon Sep 17 00:00:00 2001 From: "aden.chen" Date: Wed, 15 Oct 2025 14:38:42 +0800 Subject: [PATCH 3/3] Delay one second inside LockAsync --- .../BotSharp.Core.Crontab/Services/CrontabWatcher.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs index d50735208..e49cabbcd 100644 --- a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs +++ b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs @@ -31,14 +31,11 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) while (!stoppingToken.IsCancellationRequested) { - var delay = Task.Delay(1000, stoppingToken); - await locker.LockAsync(DIST_KEY, async () => { await RunCronChecker(scope.ServiceProvider); + await Task.Delay(1000, stoppingToken); }); - - await delay; } _logger.LogWarning("Crontab Watcher background service is stopped.");