ruby-on-railsherokudelayed-jobhirefire

Getting hirefire to work with Rails 3.1.3, DJ 3.0.0, Heroku Cedar Stack


I'm trying to get hirefire to work with Heroku Cedar Stack. I tried using this patch, but that doesn't seem to help either. Workers are not getting spun up at all. Anybody here has a solution that works?


Solution

  • I found the solution to this after I looked at hirefire source. The issue in my case was that there was a locked job in the job queue. Because of this, delayed_job.working turned out to be 1 and not 0. Also, because of the locked job, delayed_job.jobs was also 1. And hence no worker was hired. I cleared all the jobs from the queue and then hirefire worked like a charm.

        def hirefire_hire
          delayed_job = ::Delayed::Job.new
          if delayed_job.working == 0 \
          or delayed_job.jobs    == 1
            environment.hire
          end
        end
    

    I think this check should be modified to check for number of jobs that are not locked or something of a similar nature.