Reputation: 276
Calling delay on class method displays the following error:
class Foo
def self.bar
puts "hello"
end
end
Foo.delay.bar
Displays the following error
{"retry"=>true, "queue"=>"default", "class"=>"Sidekiq::Extensions::DelayedClass",
"args"=>["---\n- !ruby/class 'Foo'\n- :bar\n- []\n"], "jid"=>"0000000",
"enqueued_at"=>1391440659.34402, "error_message"=>"undefined class/module Foo",
"error_class"=>"ArgumentError", "failed_at"=>2014-02-03 15:17:39 UTC,
"retry_count"=>0}
Any idea why? Can we call delay on class methods?
Upvotes: 3
Views: 1835
Reputation: 1254
I had the same problem and restart both redis and sidekiq didn't work.
I know it weird but it seems that sidekiq isn't loading everything well, anyway, the fix was to use a dedicated worker instead of a delayed class.
I hope it helps. https://github.com/mperham/sidekiq/wiki/Getting-Started
Upvotes: 1
Reputation: 29880
It tells you why: undefined class/module Foo
Sidekiq doesn't see your Foo
class. Make sure Sidekiq is loaded in an environment that can see Foo
.
Upvotes: 0