2

In Quartz.NET, I want to get current executing jobs as a list.

var jobs = scheduler.GetCurrentlyExecutingJobs(); 

But it didn't return an IEnumerable result. I can not make it IEnumerable to get JobKeys.

Actually I want to pause a scheduled job when the other one is starting to run. But I don't know how to do.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • What does "it didn't return IEnumerable result" mean? Is it empty or null? According to the [docs](https://quartznet.sourceforge.io/apidoc/3.0/html/html/e68ced83-ceab-5b92-a923-d4d245689a82.htm) `IScheduler.GetCurrentlyExecutingJobs` returns `Task>` so maybe you are just missing an `await`? – Erik T. Jan 10 '22 at 11:37
  • Yes it returns Task>. But i can not use it in foreach loop and not get jobKey. – ibrahim avci Jan 10 '22 at 11:41
  • I want to use that method in the answer https://stackoverflow.com/questions/30326726/scheduling-concurrent-jobs-in-quartz-net – ibrahim avci Jan 10 '22 at 11:44
  • As this method is async you need to use `var jobs = await scheduler.GetCurrentlyExecutingJobs();` to be able to iterate over the returned `IReadOnlyCollection<>`. – Erik T. Jan 10 '22 at 11:49

0 Answers0