Multiple server scheduling

Hi.

I have a single database and I have 3 HangFire servers:

  • the first server → queue : “X”

  • The second server → queue : “Y”,“Z”

  • The third server → queue : “W”.

Scheduling a XXXX task, on the second server

RecurringJob.AddOrUpdate(
() => new JobB().Execute(),
Cron.Hourly(5),
null,
“Y”);

Sometimes it happens that instead of being executed by the second server, it is executed by the first.

Am I doing something wrong?

Thank you
Daniele

1 Like

If JobB fails at some point, when re-enqueued, the original Queue name is not respected, so any active server will attempt to run the job. That might be what’s happening.

There’s a discussion about that here: QueueAttribute not being persisted in database · Issue #1763 · HangfireIO/Hangfire · GitHub