Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ersion bump
  • Loading branch information...
commit 50371b0ec2d96e84ad1c298eb129fa5e3e7293f6 1 parent d48cfd8
@jayniz jayniz authored
View
8 CHANGELOG.markdown
@@ -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.
View
11 lib/resque-loner/unique_job.rb
@@ -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
View
2  lib/resque-loner/version.rb
@@ -1,7 +1,7 @@
module Resque
module Plugins
module Loner
- VERSION = "1.1.0"
+ VERSION = "1.2.0"
end
end
end
View
5 spec/loner_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.