Hangfire - Schedule job fires unexpectedly

I have set up 5 jobs to run at 4pm/5pm/6pm/7pm/8pm daily. This jobs emails reports those times. This morning, I had 5 emails at 630am as you can see by the screen shot

  1. Does anyone know why all these jobs ran at the same time.
  2. Is there a better way to set up the CRON to run them at 4pm/5pm/6pm/7pm/8pm week days?

BTW it is showing the next execution correctly. and current time is 120pm Thanks in advance

Id  Cron    Time zone   Job Next execution  Last execution  Created
SameDay 4pm 0 16 * * *  Eastern Standard Time   BRBusinessLayer.EmailAllSameDayReport   in 3 hours  7 hours ago a month ago
SameDay 5pm 0 17 * * *  Eastern Standard Time   BRBusinessLayer.EmailAllSameDayReport   in 4 hours  7 hours ago a month ago
SameDay 6pm 0 18 * * *  Eastern Standard Time   BRBusinessLayer.EmailAllSameDayReport   in 5 hours  7 hours ago a month ago
SameDay 7pm 0 19 * * *  Eastern Standard Time   BRBusinessLayer.EmailAllSameDayReport   in 6 hours  7 hours ago a month ago
SameDay 8pm 0 20 * * *  Eastern Standard Time   BRBusinessLayer.EmailAllSameDayReport   in 7 hours  7 hours ago a month ago

Update: Using 1.8.0-Beta4

Update 2
I saw there was a process that hung last night. The SameDay 7pm and SameDay 8pm, didn’t get fired until 620am this morning. I am not sure if it failed and was retrying. Seems like a very long window of retrying (about 12 hours). I cant have the report being sent that late. Should I put retries to 0?

Hangfire uses a progressively longer delay between retries, so yeah, once you get toward the last few attempts, it could be quite a bit later.

So, as you suggested in your last edit, you could set retries to zero if you didn’t want automatic retries (Dealing with Exceptions — Hangfire Documentation). That might be a bit extreme - maybe just lower the max to something between 3 and 5? That way you get some automatic requeuing, but the job will hit the failed state sooner.

1 Like