首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Resque-scheduler动态报表"schedule empty“

Resque-scheduler动态报表"schedule empty“
EN

Stack Overflow用户
提问于 2011-08-25 05:00:00
回答 1查看 2.3K关注 0票数 0

我正在尝试使用resque-scheduler gem来调度作业我安装了gem (V2.0.0d)并遵循了github上写入的信息这是我的resque.rake文件

代码语言:javascript
复制
# Resque tasks
require 'resque/tasks'
require 'resque_scheduler/tasks' 



namespace :resque do
  task :setup do
    require 'resque'
    require 'resque_scheduler'
    require 'resque/scheduler'     



# you probably already have this somewhere
Resque.redis = 'localhost:6379'

# The schedule doesn't need to be stored in a YAML, it just needs to
# be a hash.  YAML is usually the easiest.
Resque.schedule = YAML.load_file("#{Rails.root}/config/resque_schedule.yml")


# If you want to be able to dynamically change the schedule,
# uncomment this line.  A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is set to true, the scheduler process looks for 
# schedule changes and applies them on the fly.
# Note: This feature is only available in >=2.0.0.
Resque::Scheduler.dynamic = true



 end
end

但是每次我运行rake resque:scheduler的时候它都会说

加载日程安排为空!设置已加载的Resque.schedule计划

如果我删除Resque::Scheduler.dynamic = true,计划将正确加载,但我需要设置此选项,因为计划会随着时间的推移而变化

EN

回答 1

Stack Overflow用户

发布于 2012-02-08 23:30:05

您可以通过放置以下代码来修复此问题:

代码语言:javascript
复制
Resque::Scheduler.dynamic = true

就在以下内容之上:

代码语言:javascript
复制
Resque.schedule = YAML.load_file("#{Rails.root}/config/resque_schedule.yml")

有关更多信息,请查看https://github.com/bvandenbos/resque-scheduler/issues/115

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7182196

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档