bvandenbos/resque-scheduler — Issue #116: Scheduled jobs not being performed
Author: julienXX
Created: 2011-10-24 10:31:24+00:00
State: open

Hi,
My scheduled jobs are not performed with resque_scheduler but they are working fine when I run them manually.
Here is my config:

Rails 2.3.12
Resque-scheduler 1.9.9

- resque_schedule.yml:
...
queue_shortened_links_clicks_retrieval:
cron: "* */2 * * *"
class: Jobs::ShortenedLinksClicksRetrieval
queue: shortner
args:
rails_env: production
description: "This job queues jobs that fetch the click count (every 5 minutes)"
...

- lib/tasks/resque.rake:
require 'resque_scheduler'
require 'resque_scheduler/tasks'

task 'resque:setup' => :environment do
Resque.schedule = YAML.load_file(Rails.root.join('config/resque_schedule.yml'))
end

- lib/jobs/shortened_links_clicks_retrieval.rb:
require "net/http"
require "uri"

module Jobs
class ShortenedLinksClicksRetrieval
SHORTENER_SERVER = YAML.load_file(File.join(Rails.root, 'config', 'shortner.yml'))[RAILS_ENV]["url"]

@queue = :shortner

include Resque::Plugins::UniqueJob

def self.perform
log! "[Jobs::ShortenedLinksClicksRetrieval] Refreshing click analytics..."
...

I run the rake task with:
RAILS_ENV=production VVERBOSE=1 NAMESPACE=scheduling bundle exec rake resque:scheduler

and I can see:
2011-10-24 06:12:25 Scheduling queue_shortened_links_clicks_retrieval
2011-10-24 06:15:00 queueing Jobs::ShortenedLinksClicksRetrieval (queue_shortened_links_clicks_retrieval)
2011-10-24 06:20:00 queueing Jobs::ShortenedLinksClicksRetrieval (queue_shortened_links_clicks_retrieval)

and nothing else. I even tried to put a dummy job name in my resque_schedule.yml and it won't complain:
2011-10-24 06:15:00 queueing Jobs::ShortenedLinksClicksRetrievalDummy (queue_shortened_links_clicks_retrieval)

Can you please help?