在 resque 调度程序中调度动态作业
我正在尝试使用 Rails 3 和 resque 调度程序测试将来的调度作业:
以下是我正在使用的代码,但我收到 NoMethodError set_schedule。
Resque.set_schedule("1", {
:cron => "30 6 * * 1",
:class => "Notify",
:queue => "username",
:message => 'notification message'
})
我尝试使用简单的排队 Resque.enqueue(Notify, params[:message])
并且效果很好。
更新:
以下是我收到的错误:
undefined method `set_schedule' for Resque Client connected to redis://bass.redistogo.com:9064/0:Module
I'm trying to test out scheduling jobs in future using rails 3 and resque scheduler:
Following is the code I'm using but I'm getting NoMethodError set_schedule.
Resque.set_schedule("1", {
:cron => "30 6 * * 1",
:class => "Notify",
:queue => "username",
:message => 'notification message'
})
I tried using a simple enqueue Resque.enqueue(Notify, params[:message])
and this works fine.
UPDATE:
Following is the error I'm getting:
undefined method `set_schedule' for Resque Client connected to redis://bass.redistogo.com:9064/0:Module
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
resque 中的调度(现在)位于单独的 gem 中。您可以在以下位置找到所需的所有信息:
https://github.com/bvandenbos/resque-scheduler/
Scheduling in resque is (now) in a separate gem. You can find all the information you need at:
https://github.com/bvandenbos/resque-scheduler/
尝试
在
class NotifyController
之前 添加ActionController::Base
try adding
before
class NotifyController < ActionController::Base
我遇到了同样的问题。看起来此站点上的 v1.9.9 gem 文件 resque_scheduler.rb 与从 rubygems.org 下载的文件之间存在差异。
您需要获取 2.0.0 预发行版,并使用以下命令启用动态调度:
I'm getting the same problem. It looks like there is a difference between the v1.9.9 gem file resque_scheduler.rb on this site, and that being downloaded from rubygems.org.
You need to get the 2.0.0 pre-release, and also enable dynamic scheduling using :