Merge pull request #858 from hchen2020/master

Add IsRealTime Flag
This commit is contained in:
Haiping 2025-01-31 17:11:58 -06:00 committed by GitHub
commit 98eb763f05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View file

@ -5,5 +5,10 @@ namespace BotSharp.Core.Crontab.Abstraction;
/// </summary>
public interface ICrontabSource
{
/// <summary>
/// Set to true if the cron is real-time like Change Data Capture (CDC).
/// </summary>
bool IsRealTime => false;
CrontabItem GetCrontabItem();
}

View file

@ -51,6 +51,10 @@ public class CrontabService : ICrontabService, ITaskFeeder
var cronsources = _services.GetServices<ICrontabSource>();
foreach (var source in cronsources)
{
if (source.IsRealTime)
{
continue;
}
var item = source.GetCrontabItem();
fixedCrantabItems.Add(source.GetCrontabItem());
}

View file

@ -45,7 +45,6 @@ public class CrontabWatcher : BackgroundService
{
var cron = services.GetRequiredService<ICrontabService>();
var crons = await cron.GetCrontable();
var publisher = services.GetService<IEventPublisher>();
foreach (var item in crons)