resque-scheduler: Scheduled jobs not shown under Schedule tab

After upgrading to 4.2.0 from 4.1.0, our scheduled jobs (loaded statically) are no longer visible under the Schedule tab, but still seem to work (i.e. get scheduled!). Some code (part of a Rails app):

config/routes.rb

require 'resque/scheduler/server'
require 'resque/server'
Rails.application.routes.draw do
...

lib/tasks/resque.rake

namespace :resque do
  task setup_schedule: :setup do
    require 'resque-scheduler'
    Resque.schedule = YAML.load_file('config/schedule.yml')
  end

  task scheduler: :setup_schedule
end

I tried switching to a dynamic schedule, but that doesn’t seem to help. Downgrading resque-scheduler (only) to 4.1.0 and everything works again…

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

Yes, moving this line

Resque.schedule = YAML.load_file Rails.root.join('config', 'resque_schedule.yml')

from lib/tasks/resque.rake to config/initializers/resque.rb did the trick. The tasks are scheduled by the scheduler and displayed by the web server

Maybe this should be added to the Readme

Correct, the resque-web must have some resque-scheduler configuration done for it to work correctly.

You’re right @carsonreinke, I wouldn’t normally be using those options. Unfortunately I can’t put Resque.schedule = … in an initializer, as this requires redis to be running whenever I run any task in the Rails environment, including assets:precompile (which I run as part of an isolated Docker build).

Adding ‘persist:true’ for each job in the schedule forces it to be stored in redis, which means it’s visible in the UI. I agree that’s not what it should be used for - I was just trying to look for a solution that worked for me. Since I don’t really need the Schedules tab, I think I’ll just get rid of it 😃

The Readme is still wrong, though - https://github.com/resque/resque-scheduler#changes-as-of-200.