I have a problem using Delayed::Job 2.1.4
on a very simple class, which is:
class C2dmJob < Struct.new(:msg)
def perform
# doing something
end
end
At the begining I put this class at the lib
directory but moved it after to the model directory for testing purposes. When running: Delayed::Job.enqueue C2dmJob.new('foo')
I get the following entry stored inside the Delayed::Job
table:
0, handler: "--- !ruby/struct:C2dmJob \nmsg: foo\n", last_error: nil, run_at: "2011-07-21 10:56:58", locked_at: nil, failed_at: nil, locked_by: nil, created_at: "2011-07-21 10:56:58", updated_at: "2011-07-21 10:56:58">
And the job fails with the following error message:
[Worker(host:xxx pid:2660)] C2dmJob failed with 开发者_Go百科NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each - 1 failed attempts
What do you think is wrong? I suspect something related to serialization but I have no clue what exactly!
Thanks!
the reason is the class names coincidence, DelayedJob is looking for perform method into another class with the same name
精彩评论