From 19e957ef258e584f811b7efccad8978f7b1da6cd Mon Sep 17 00:00:00 2001
From: Jicheng Lu <103353@smsassist.com>
Date: Tue, 12 Aug 2025 16:35:31 -0500
Subject: [PATCH] refine code
---
.../BotSharp.Abstraction/Crontab/ICrontabHook.cs | 4 +---
.../BotSharp.Core.Crontab/Services/CrontabService.cs | 2 +-
.../BotSharp.Core.Crontab/Services/CrontabWatcher.cs | 4 ++++
.../BotSharp.Plugin.SqlDriver.csproj | 7 +++----
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabHook.cs b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabHook.cs
index b92fd8f5..94284150 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabHook.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabHook.cs
@@ -7,9 +7,7 @@ public interface ICrontabHook : IHookBase
string[]? Triggers
=> null;
- void OnAuthenticate(CrontabItem item)
- {
- }
+ void OnAuthenticate(CrontabItem item) { }
Task OnCronTriggered(CrontabItem item)
=> Task.CompletedTask;
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs
index b2101ee5..ce72b23b 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs
+++ b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs
@@ -56,7 +56,7 @@ public class CrontabService : ICrontabService, ITaskFeeder
continue;
}
var item = source.GetCrontabItem();
- fixedCrantabItems.Add(source.GetCrontabItem());
+ fixedCrantabItems.Add(item);
}
return fixedCrantabItems;
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs
index 1546cb7c..5933e372 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs
+++ b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs
@@ -87,6 +87,9 @@ public class CrontabWatcher : BackgroundService
{
_logger.LogInformation($"The current time matches the cron expression {item}");
+#if DEBUG
+ await HandleCrontabEvent(item);
+#else
if (publisher != null)
{
await publisher.PublishAsync($"Crontab:{item.Title}", item.Cron);
@@ -95,6 +98,7 @@ public class CrontabWatcher : BackgroundService
{
await HandleCrontabEvent(item);
}
+#endif
}
}
catch (Exception ex)
diff --git a/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj b/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj
index 242097eb..2e7b802d 100644
--- a/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj
+++ b/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj
@@ -11,8 +11,11 @@
+
+
+
@@ -108,8 +111,4 @@
-
-
-
-