Delayed_job: Job failed to load: uninitialized constant Syck::Syck

我与影子孤独终老i 提交于 2019-12-01 08:11:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!