Hangfire Recurring Job Scheduling

We have a hangfire recurring job which runs every 1 minute. However if the job is not able to complete in 1 minute does hangfire schedule another instance of the same Job.

How can be tell hangfire to not schedule the same job if it has not been completed?

Not that I know of. Running something every minute sounds like something that should be monitored with a normal service, but if you insist on using HF, I would change the job itself to be smarter about the last time it was completed. Either with a check to a database or something where it will just complete if the last job was not completed more than 45s ago (not updating that particular run complete time).

Alternatively (though not good practice) you could schedule the next job a minute after the current one completed. If done poorly, this could be prone to failure in the string of job queuing if the job fails.

Again, running every minute continuously I would probably use a normal service timer, something like this: https://stackoverflow.com/questions/246697/best-timer-for-using-in-a-windows-service HF is awesome, but you would have your job server ping for jobs quite frequently. Somebody might know a better way.

Have you tried the attribute DisableConcurrentExecution?

E.g. [DisableConcurrentExecution(60)]