Hangfire
Hangfire copied to clipboard
Failed recurring job hops from a designated queue to the default queue.
This issue is very similar to #705!
I currently have a queue name mx-cron. I have a recurring task that runs every 6 hours. The job is created in my scheduler.
RecurringJob.AddOrUpdate<IAccountJob>(nameof(AccountJob), job => job.Run(JobCancellationToken.Null), $"0 */6 * * *", TimeZoneInfo.Utc, queue: "mx-cron");
Everything works fine if the job is completed successfully. However, when an exception is thrown, the retry is then queued in the "default" queue. I don't have a default queue created in my application; thus, the retries never happen.
The screenshot below describes this issue very well.
- Job is created.
- It's enqueued in the correct queue, mx-cron.
- Exception is thrown. Job fails.
- It is scheduled.
- The scheduled retry is queued in the default queue.

I don't want the retry to hop from it's original queue.
Hi - Any update on this issue?
Unfortunately that queue parameter only works once, when background job is created, and doesn't work for its retries due to internal reasons. Version 1.8.0 will bring better support for queues that will solve this issue (and even deprecate this method that doesn't lead to predictable results). But in current versions the best solution for this is to use the Queue attribute and the following syntax to have queue consistent no matter what.
[Queue("{0}")]
public static void MyMethod(string queue, int otherArg) {}
BackgroundJob.Enqueue(() => MyMethod("mx-cron", 12345));
Hello @odinserj, can you please confirm that this is solved in 1.8.0? Thanks :)
Yes, can confirm it's closed when using new method overloads with queue specified explicitly.