resque-scheduler fails on job remove

放肆的年华 提交于 2020-01-06 18:01:27

问题


I have used the POC from the Github (queue was missing to I have added it:

name = 'send_emails'
config = {}
config[:class] = 'SendEmail'
config[:args] = 'POC email subject'
config[:cron] = '* * * * * *'
config[:persist] = true
config[:queue] = 'new'
Resque.set_schedule(name, config)
sleep(10)
#Try to remove the job
Resque.remove_schedule(name)

I get the following error:

/var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler.rb:295:in `block in update_schedule': undefined method `keys' for nil:NilClass (NoMethodError)
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler.rb:292:in `loop'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler.rb:292:in `update_schedule'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler.rb:57:in `block in run'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler.rb:53:in `loop'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler.rb:53:in `run'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler/cli.rb:117:in `run_forever'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler/cli.rb:90:in `run!'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/lib/resque/scheduler/cli.rb:80:in `run!'
        from /var/lib/gems/1.9.1/gems/resque-scheduler-3.0.0/bin/resque-scheduler:5:in `<top (required)>'
        from /usr/local/bin/resque-scheduler:19:in `load'
        from /usr/local/bin/resque-scheduler:19:in `<main>'

回答1:


This is a bug in rescue scheduler. When you remove the last job, the scheduler fails. The bug has been fixed in later releases. You can find complete details here



来源:https://stackoverflow.com/questions/25109370/resque-scheduler-fails-on-job-remove

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