diff --git a/src/modules/scheduling/Elsa.Scheduling.Hangfire/Services/HangfireWorkflowScheduler.cs b/src/modules/scheduling/Elsa.Scheduling.Hangfire/Services/HangfireWorkflowScheduler.cs index 3b389e68..bff4c4e9 100644 --- a/src/modules/scheduling/Elsa.Scheduling.Hangfire/Services/HangfireWorkflowScheduler.cs +++ b/src/modules/scheduling/Elsa.Scheduling.Hangfire/Services/HangfireWorkflowScheduler.cs @@ -97,7 +97,9 @@ private IEnumerable GetQueuedJobIds(string taskName) private IEnumerable GetRecurringJobIds(string taskName) { using var connection = jobStorage.GetConnection(); - var jobs = connection.GetRecurringJobs().Where(x => x.Job.Type == typeof(TJob) && (string)x.Job.Args[0] == taskName); + var jobs = connection.GetRecurringJobs() + .Where(x => x.Job is { Args.Count: > 0 } && x.Job.Type == typeof(TJob) && (string)x.Job.Args[0] == taskName); + return jobs.Select(x => x.Id).Distinct().ToList(); } } \ No newline at end of file