Hangfire queues recurring jobs

1.1k views Asked by At

I use hangfire to run recurring jobs. My job get current data from the database, perform an action and leave a trace on records processed. If a job didn't run this minute - I have no need to run it twice the next minute.

Somehow I got my recurring jobs (1 minute cycle) queued by their thousands and never executed. When I restarted my IIS it tried to execute them all at once and clog the DB.

Besides than fixing the problem of no execution, is there a way to stop them from queuing up?

1

There are 1 answers

0
mCasamento On

If you want to disable retry of failed job simply decorate your method with an AutomaticRetryAttribute and set Attempts to 0

See https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.Core/AutomaticRetryAttribute.cs for more details