Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add resque scheduler

  • Loading branch information...
commit 494298ee4a367616deacb95817289effa6c399c1 1 parent 3b37ff7
Richie Min mrichie authored
Showing with 41 additions and 0 deletions.
  1. +2 −0  .gitignore
  2. +1 −0  Gemfile
  3. +7 −0 Gemfile.lock
  4. +31 −0 lib/tasks/resque.rake
2  .gitignore
View
@@ -7,3 +7,5 @@ tmp/*
/.bundle
/db/*.sqlite3
/log/*.log
+.powrc
+.rvmrc
1  Gemfile
View
@@ -27,6 +27,7 @@ gem 'haml-rails'
# Jobs
gem 'resque'
+gem 'resque-scheduler', :require => 'resque_scheduler'
# Format dates
gem 'stamp'
7 Gemfile.lock
View
@@ -155,6 +155,10 @@ GEM
redis-namespace (~> 1.0)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
+ resque-scheduler (2.0.0)
+ redis (>= 2.0.1)
+ resque (>= 1.20.0)
+ rufus-scheduler
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
@@ -169,6 +173,8 @@ GEM
railties (>= 3.0)
rspec (~> 2.11.0)
rubyzip (0.9.9)
+ rufus-scheduler (2.0.17)
+ tzinfo (>= 0.3.23)
sass (3.2.1)
sass-rails (3.2.5)
railties (~> 3.2.0)
@@ -243,6 +249,7 @@ DEPENDENCIES
rb-fsevent
rb-inotify
resque
+ resque-scheduler
rspec-rails
sass-rails (~> 3.2.3)
settingslogic
31 lib/tasks/resque.rake
View
@@ -1 +1,32 @@
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'
+
+ # 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
+
+ # 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('your_resque_schedule.yml')
+
+ # If your schedule already has +queue+ set for each job, you don't
+ # need to require your jobs. This can be an advantage since it's
+ # less code that resque-scheduler needs to know about. But in a small
+ # project, it's usually easier to just include you job classes here.
+ # So, something like this:
+ #require 'jobs'
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.