collectiveidea/delayed_job — Issue #361: I have a delayed job in a Module, it works in my development evn, but doesn't work in test env
Author: rhuichao
Created: 2012-03-06 07:39:54+00:00
State: open

Hi,

I have a delayed job in a Module,
Module DelayedJobUtil
def self.do_something()
end
end

and I want to invoke this method in my controller,

class TestController < ApplicationController

def invoke()
DelayedJobUtil.delay.do_somrthing()
end
end

This works in my local development environment, but doesn't work in the test environment

The job was successfully inserted into the database, but I found the value of the ‘handler’ column in delayed_jobs table is
" | --- !ruby/object:Delayed::PerformableMethod
object: !ruby/object:Module {}
xxxxxx
xxxxxx "

The Module was missing, then i got the error message in delayed log file
" Module#do_something failed with NoMethodError: undefined method `do_something' for # "

currently our solution is change the Module to a Class

it's appreciated for any one could help to explain it ?

my local environment:
Ubuntu 11.04
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
Rails 3.0.7
delayed_job (3.0.1)
delayed_job_active_record (0.3.2)

test server:
Ubuntu 11.04
ruby 1.9.2p289 (2011-07-04 revision 32391) [x86_64-linux]
Rails 3.0.9
delayed_job (3.0.1)
delayed_job_active_record (0.3.2)