本文介绍了resque-scheduler删除作业失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了来自Github的POC(我添加了队列,但我没有添加它:

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)

我收到以下错误:

/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>'

推荐答案

这是救援调度程序中的错误.当您删除最后一个作业时,调度程序将失败.该错误已在更高版本中修复.您可以在此处

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

这篇关于resque-scheduler删除作业失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 09:12