Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more wordsmithing

  • Loading branch information...
commit 5d150c1eb1b65e517a83255c8a07b8596b2a705b 1 parent 20fc5d9
scotttam authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 README.markdown
10 README.markdown
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.