views:

149

answers:

1

I'm using delayed_job (tried both tobi's and collective_idea's) on site5.com shared hosting, with passenger as rails environment. I managed to make jobs done. However, it seems the plugin ignores any changes in a job class source code after first run. I have restarted the server on every change (touch tmp/restart.txt) but it still ignores it.

Example:

file: lib/xx_job.rb

class XxJob
  def perform
    Rails.logger.info "XX START"

    TempTest.delete_all

    i = 0
    10.times {
      i+=1
      TempTest.create(:name => "XXX")
      sleep(1)
    }

    Rails.logger.info "XX END"
  end
end

In a simple controller I call:

Delayed::Job.enqueue(XxJob.new)

Conclusions I have gathered:

  1. If I change xx_job.rb to xx_job1.rb - error on the controller
  2. If I change class XxJob to class XxJob1 - error on the controller
  3. If I delete all the perform method content - the old code old code is executed
  4. New .rb file with class and perform, enqueue this class - works perfectly
  5. If I change something in that new file's perform and run job again - old code is executed

Between every change I made a restart for the server. It seems like Passenger or something else saves class cache.

How can I delete this cache? Is is stored on the server somewhere? (I hope I have access to it from the shared hosting)

Thanks!

A: 

Eventually I figured that out - several workers were running in background, each of them caught a job and had their own cache. I didn't know how to kill them so I changed the table's name for several seconds. That killed them :)

Then I used http://wiki.github.com/tobi/delayed%5Fjob/running-delayedworker-as-a-daemon as worker start, and it works great.

elado