Skip to content

Commit 11d8580

Browse files
authored
Merge pull request #1157 from yileicn/master
add crontab debug config
2 parents 7a301dc + 87c18c4 commit 11d8580

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Infrastructure/BotSharp.Abstraction/Crontab/Settings/CrontabSettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ public class CrontabSettings
55
public CrontabBaseSetting EventSubscriber { get; set; } = new();
66
public CrontabBaseSetting Watcher { get; set; } = new();
77
public string LockName { get; set; } = "CrontabWatcher:locker";
8+
public DebugSetting Debug { get; set; } = new();
89
}
910

1011
public class CrontabBaseSetting
1112
{
1213
public bool Enabled { get; set; } = true;
1314
}
15+
16+
public class DebugSetting
17+
{
18+
public string AllowRuleTrigger { get; set; } = "";
19+
}

src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ private async Task RunCronChecker(IServiceProvider services)
9393
_logger.LogInformation($"The current time matches the cron expression {item}");
9494

9595
#if DEBUG
96-
await HandleCrontabEvent(item);
96+
if (item.Title == settings.Debug.AllowRuleTrigger)
97+
{
98+
await HandleCrontabEvent(item);
99+
}
97100
#else
98101
if (publisher != null)
99102
{

0 commit comments

Comments
 (0)