HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.41k stars 1.7k forks source link

Recurring jobs are *not* sorted by next execution time #2315

Open abelbraaksma opened 1 year ago

abelbraaksma commented 1 year ago

According to this comment in this issue (https://github.com/HangfireIO/Hangfire/issues/391#issuecomment-465602406), recurring jobs are supposed to be sorted by next execution moment. That is, a job stated to run in 2 days will come before a job run in 3 days etc.

However, this does not happen. It seems to generally be sorted that way, but that may well be because that just so happens to be the creation date of most jobs in our situation.

I thought for a moment that maybe failed jobs are held at the top until rescheduled/succeeded, but that isn't true either. In fact, there seems to be no order at all in the jobs, or I'm just misunderstanding the logic:

odinserj commented 1 year ago

What storage implementation you are using? I just ensured that the official ones, e.g. Hangfire.SqlServer, Hangfire.Pro.Redis and Hangfire.InMemory make this type of sorting.