Merge pull request #1157 from yileicn/master

add crontab debug config
This commit is contained in:
Nick Yi 2025-09-10 14:11:45 +08:00 committed by GitHub
commit 11d85805d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -5,9 +5,15 @@ public class CrontabSettings
public CrontabBaseSetting EventSubscriber { get; set; } = new();
public CrontabBaseSetting Watcher { get; set; } = new();
public string LockName { get; set; } = "CrontabWatcher:locker";
public DebugSetting Debug { get; set; } = new();
}
public class CrontabBaseSetting
{
public bool Enabled { get; set; } = true;
}
public class DebugSetting
{
public string AllowRuleTrigger { get; set; } = "";
}

View file

@ -93,7 +93,10 @@ public class CrontabWatcher : BackgroundService
_logger.LogInformation($"The current time matches the cron expression {item}");
#if DEBUG
await HandleCrontabEvent(item);
if (item.Title == settings.Debug.AllowRuleTrigger)
{
await HandleCrontabEvent(item);
}
#else
if (publisher != null)
{