Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating readme

  • Loading branch information...
commit ac312f6482d1016187749f15944e8bd69b7fd955 1 parent 33ec033
@bvandenbos bvandenbos authored
Showing with 49 additions and 43 deletions.
  1. +49 −43 README.markdown
View
92 README.markdown
@@ -95,48 +95,6 @@ If you have the need to cancel a delayed job, you can do so thusly:
# remove the job with exactly the same parameters:
Resque.remove_delayed(SendFollowUpEmail, :user_id => current_user.id)
-### Schedule jobs per environment
-
-Resque-Scheduler allows to create schedule jobs for specific envs. The arg
-`rails_env` (optional) can be used to determine which envs are concerned by the
-job:
-
- create_fake_leaderboards:
- cron: "30 6 * * 1"
- class: CreateFakeLeaderboards
- queue: scoring
- args:
- rails_env: demo
- description: "This job will auto-create leaderboards for our online demo"
-
-The scheduled job create_fake_leaderboards will be created only if the
-environment variable `RAILS_ENV` is set to demo:
-
- $ RAILS_ENV=demo rake resque:scheduler
-
-NOTE: If you have added the 2 lines bellow to your Rails Rakefile
-(ie: lib/tasks/resque-scheduler.rake), the rails env is loaded automatically
-and you don't have to specify RAILS_ENV if the var is correctly set in
-environment.rb
-
-Alternatively, you can use your resque initializer to avoid loading the entire
-rails stack.
-
- $ rake resque:scheduler INITIALIZER_PATH=config/initializers/resque.rb
-
-
-Multiple envs are allowed, separated by commas:
-
- create_fake_leaderboards:
- cron: "30 6 * * 1"
- class: CreateFakeLeaderboards
- queue: scoring
- args:
- rails_env: demo, staging, production
- description: "This job will auto-create leaderboards"
-
-NOTE: If you specify the `rails_env` arg without setting RAILS_ENV as an
-environment variable, the job won't be loaded.
### Dynamic Schedules
@@ -148,7 +106,8 @@ Resque and setting `Resque::Scheduler.dynamic` to `true`. Then subsequently
updating the "`schedules`" key in redis, namespaced to the Resque namespace.
The "`schedules`" key is expected to be a redis hash data type, where the key
is the name of the schedule and the value is a JSON encoded hash of the
-schedule configuration.
+schedule configuration. There are methods on Resque to make this easy (see
+below).
When the scheduler loops it will look for differences between the existing
schedule and the current schedule in redis. If there are differences it will
@@ -174,6 +133,9 @@ For example:
:queue => scoring
})
+In this way, it's possible to completely configure your scheduled jobs from
+inside your app if you so desire.
+
### Support for customized Job classes
Some Resque extensions like
@@ -213,6 +175,50 @@ custom job class to support the #scheduled method:
end
+### Schedule jobs per environment
+
+Resque-Scheduler allows to create schedule jobs for specific envs. The arg
+`rails_env` (optional) can be used to determine which envs are concerned by the
+job:
+
+ create_fake_leaderboards:
+ cron: "30 6 * * 1"
+ class: CreateFakeLeaderboards
+ queue: scoring
+ args:
+ rails_env: demo
+ description: "This job will auto-create leaderboards for our online demo"
+
+The scheduled job create_fake_leaderboards will be created only if the
+environment variable `RAILS_ENV` is set to demo:
+
+ $ RAILS_ENV=demo rake resque:scheduler
+
+NOTE: If you have added the 2 lines bellow to your Rails Rakefile
+(ie: lib/tasks/resque-scheduler.rake), the rails env is loaded automatically
+and you don't have to specify RAILS_ENV if the var is correctly set in
+environment.rb
+
+Alternatively, you can use your resque initializer to avoid loading the entire
+rails stack.
+
+ $ rake resque:scheduler INITIALIZER_PATH=config/initializers/resque.rb
+
+
+Multiple envs are allowed, separated by commas:
+
+ create_fake_leaderboards:
+ cron: "30 6 * * 1"
+ class: CreateFakeLeaderboards
+ queue: scoring
+ args:
+ rails_env: demo, staging, production
+ description: "This job will auto-create leaderboards"
+
+NOTE: If you specify the `rails_env` arg without setting RAILS_ENV as an
+environment variable, the job won't be loaded.
+
+
Resque-web additions
--------------------
Please sign in to comment.
Something went wrong with that request. Please try again.