README.md in resque-lock-timeout-0.3.0 vs README.md in resque-lock-timeout-0.3.1
- old
+ new
@@ -1,9 +1,9 @@
Resque Lock Timeout
===================
-A [Resque][rq] plugin. Requires Resque 1.8.0.
+A [Resque][rq] plugin. Requires Resque >= 01.8.0.
resque-lock-timeout adds locking, with optional timeout/deadlock handling to
resque jobs.
Using a `lock_timeout` allows you to re-aquire the lock should your worker
@@ -107,9 +107,33 @@
def self.perform(repo_id)
heavy_lifting
end
end
+
+### Setting Timeout At Runtime
+
+You may define the `lock_timeout` method to adjust the timeout at runtime
+using job arguments. e.g.
+
+ class UpdateNetworkGraph
+ extend Resque::Plugins::LockTimeout
+ @queue = :network_graph
+
+ def self.lock_timeout(repo_id, timeout_minutes)
+ 60 * timeout_minutes
+ end
+
+ def self.perform(repo_id, timeout_minutes = 1)
+ heavy_lifting
+ end
+ end
+
+### Helper Methods
+
+* `locked?` - checks if the lock is currently held.
+* `refresh_lock!` - Refresh the lock, useful for jobs that are taking longer
+ then usual but your okay with them holding on to the lock a little longer.
### Callbacks
Several callbacks are available to override and implement your own logic, e.g.
\ No newline at end of file