Permalink
Browse files

more wordsmithing

  • Loading branch information...
1 parent 20fc5d9 commit 5d150c1eb1b65e517a83255c8a07b8596b2a705b scotttam committed Mar 9, 2010
Showing with 6 additions and 4 deletions.
  1. +6 −4 README.markdown
View
10 README.markdown
@@ -19,20 +19,22 @@ In your class, add the can_run_every in which the job should be throttled. Examp
By default, the key which identifies the job is simply the class name. If you'd like
to override that to be more granular, you can do that in the identifier class method
-by returning a string. Example:
+by returning a string. For example, if you want the job to be limit to once a day per
+account, do something like the following:
class MyThrottledJob < Resque::ThrottledJob
throttle :can_run_every => 24.hours
def self.identifier(*args)
- some_id = *args
- thing = MyClass.find_by_id(some_id)
- "some_id:#{thing.thing_id}"
+ account_id = *args
+ "account_id:#{account_id}"
end
#rest of your class here
end
+The *args passed to identifier are the same arguments that are passed to perform.
+
When a job is throttled, it will raise a ThrottledError and the job will not be enqueued.
Contributing

0 comments on commit 5d150c1

Please sign in to comment.