Hangfire enqueue jobs taking too long to execute

Tags: #<Tag:0x00007f459da4ed60>

Hi,
I have been using hangfire’s enqueue method for the past seven months. However, off-late, Multiple requests seem to be failing.

My implementation involves a call being made to an API. This call triggers a requests which is enqueued to Hangfire. If hangfire takes too long, the request times out and I get an error.

Looking into the logs I found that usually it took 0.2 seconds to process the job (time difference between [Hangfire].[Job].[CreatedAt] and [Hangfire].[Job].[ExpiredAt]. However, all the jobs which failed take more than 10 seconds to process(some get stuck in ‘Enqueue’ state forever)

What can I do to improve the turnaround time vis-a-vis performance?

Here’s some Additional information about the environment:

The Sql Server we are using is SQL SERVER 14.0.3164.1
The Hangfire version we are using is 1.7.4

I read in another thread about the possibility of a race condition between task initialisation and assignment to worker thread here

I’ve added Hangfire Core 1.7.4 as suggested.
the tasks are still getting stuck.

Thanks in advance