问题
Here's the error:
>> Delayed::Job.find(:last).last_error
=> {Job failed to load: uninitialized constant Syck::Syck. Handler: \"--- !ruby/struct:Delayed::PerformableMethod \\nobject: &id007 !ruby/object:TryController \\n _action_name: create
but I have syck ext installed.
Usage:
def create_user(name,pass,time)
puts "hello"
Net::HTTP.get(URI.parse("http://www.example.net/buildtest.php?hao=#{name}&mi=#{pass}&da=#{time}"))
end
def create
delay.create_user("nihao000oei9","1","1")
end
gem 'delayed_job', '2.1.4'
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
Rails 3.0.1
thanks.
回答1:
I found this as an issue when I upgraded from Rails 2 to 3 and deployed to the Heroku Cedar stack. It's an issue when Delayed_Job attempts to deserialise the handler from the Job queue item. By default it uses the Syck YAML parser.
Turns out Syck isn't available on the Heroku Cedar stack.
Including the Psych gem and redeploying fixed it for me and allow me to re-invoke the failed jobs.
gem 'psych'
回答2:
I just ran into this and it turned out to be a syntax error in my just-modified database.yml.
It was using a bad reference for cucumber:
test: &test
database: test
cucumber:
<<: &base
来源:https://stackoverflow.com/questions/5367228/delayed-job-job-failed-to-load-uninitialized-constant-sycksyck