Add IsRealTime Flag

This commit is contained in:
Haiping Chen 2025-01-31 10:37:04 -06:00
parent 964de973fb
commit 2e00e7bed9
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)