Merge pull request #1033 from yileicn/master

Fix the issue of UserIdentity loss
This commit is contained in:
易磊 2025-04-25 17:33:23 +08:00 committed by GitHub
commit d02cae9222
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -5,6 +5,10 @@ public interface ICrontabHook
string[]? Triggers
=> null;
void OnAuthenticate(CrontabItem item)
{
}
Task OnCronTriggered(CrontabItem item)
=> Task.CompletedTask;

View file

@ -115,11 +115,12 @@ public class CrontabService : ICrontabService, ITaskFeeder
public async Task ScheduledTimeArrived(CrontabItem item)
{
_logger.LogDebug($"ScheduledTimeArrived {item}");
await HookEmitter.Emit<ICrontabHook>(_services, async hook =>
{
if (hook.Triggers == null || hook.Triggers.Contains(item.Title))
{
hook.OnAuthenticate(item);
await hook.OnTaskExecuting(item);
await hook.OnCronTriggered(item);
await hook.OnTaskExecuted(item);