Permalink
Browse files

Merged @unclebilly's ttl feature with some mini changes and a 1.2.0 v…

…ersion bump
  • Loading branch information...
jayniz committed Jan 5, 2012
1 parent d48cfd8 commit 50371b0ec2d96e84ad1c298eb129fa5e3e7293f6
Showing with 15 additions and 11 deletions.
  1. +8 −0 CHANGELOG.markdown
  2. +5 −6 lib/resque-loner/unique_job.rb
  3. +1 −1 lib/resque-loner/version.rb
  4. +1 −4 spec/loner_spec.rb
View
@@ -1,3 +1,11 @@
+1.2.0
+--------------------------------
+Thanks @unclebilly for your pull request. Resque-loner now supports
+a maximum time for which a job should be unique. Just define @loner_ttl
+in your job (or leave it at -1 to never expire) and after @loner_ttl
+seconds your job can be enqueued again, even if an older one is still
+marked as running.
+
1.1.0
--------------------------------
Merged in @ryansch's pull requests to clean up things a bit.
@@ -35,19 +35,18 @@ def redis_key(payload)
end
#
- # The default ttl of a locking key is -1, i.e. forever. If for some reason you only
- # want the lock to be in place after a certain amount of time, override this method
- # in your job. For example:
+ # The default ttl of a locking key is -1, i.e. forever. If for some reason you only
+ # want the lock to be in place after a certain amount of time, just set a ttl for
+ # for your job. For example:
#
# class FooJob
# include Resque::Plugins::UniqueJob
- # def self.loner_ttl
- # 40
+ # @loner_ttl = 40
# end
# end
#
def loner_ttl
- -1
+ @loner_ttl || -1
end
end # ClassMethods
@@ -1,7 +1,7 @@
module Resque
module Plugins
module Loner
- VERSION = "1.1.0"
+ VERSION = "1.2.0"
end
end
end
View
@@ -36,10 +36,7 @@ def self.perform(foo); end
class UniqueJobWithTtl
include Resque::Plugins::UniqueJob
@queue = :unique_with_ttl
-
- def self.loner_ttl
- 300
- end
+ @loner_ttl = 300
def self.perform(*args); end
end

0 comments on commit 50371b0

Please sign in to comment.