refine code

This commit is contained in:
Jicheng Lu 2025-08-12 16:35:31 -05:00
parent d19a4e1aaf
commit 19e957ef25
4 changed files with 9 additions and 8 deletions

View file

@ -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;

View file

@ -56,7 +56,7 @@ public class CrontabService : ICrontabService, ITaskFeeder
continue;
}
var item = source.GetCrontabItem();
fixedCrantabItems.Add(source.GetCrontabItem());
fixedCrantabItems.Add(item);
}
return fixedCrantabItems;

View file

@ -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)

View file

@ -11,8 +11,11 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="Helpers\**" />
<Compile Remove="packages\**" />
<EmbeddedResource Remove="Helpers\**" />
<EmbeddedResource Remove="packages\**" />
<None Remove="Helpers\**" />
<None Remove="packages\**" />
</ItemGroup>
@ -108,8 +111,4 @@
<ProjectReference Include="..\..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Helpers\" />
</ItemGroup>
</Project>