resque-unique_in_queue 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e30c8af96e86631667f2db600c1db1c4c899545768b31e71b06369fe7deadae2
4
- data.tar.gz: 49a655900fa76b81c9a6a21125876b2139445d62b15c37df3c12b63024987e0a
3
+ metadata.gz: 8e2b27c8cf85da28ed578801b934b56a5865ea25518013b904379faf98f5ee7c
4
+ data.tar.gz: 2b4cc6f023e5b6c54fe80f5b0adbb026fc93e8510830e5b39f129272d5f3d95d
5
5
  SHA512:
6
- metadata.gz: 5d7bdca79452ea3d91e8832855ff37b4f25e925d31b8d8742be36c1b55fdb165d2183b1575d40c29ae15f78a5a0bbeb3014d5f906240e58572eba582a4f78a95
7
- data.tar.gz: 0efd0b2c7dd9686b53982c044fcae0532083f674d8323742709185df50d3abfb0b49102ad6ad2fb73f538515a1e9092ece516e182f8b693318cef5160946c4af
6
+ metadata.gz: 111c91bbb3c9fd405c528c95276e548355a144d54e220f8889866664c67adeea634438b8ed268d1b1fab9901b777612449681c76bcbe1d18f35323ec4efadc92
7
+ data.tar.gz: 7a1757c1e3ff7d3c56bccaddc14b38b635fe57b3fdcd6dc213b4e08864d85b1897122d081708c4c3e6185918599ae22b3bc7ceb57407ddb49314f78670f7e163
@@ -63,6 +63,14 @@ module Resque
63
63
  @uniqueness_configuration.log_level = log_level
64
64
  end
65
65
 
66
+ def unique_in_queue_key_base
67
+ Configuration.unique_in_queue_key_base
68
+ end
69
+
70
+ def unique_in_queue_key_base=(key_base)
71
+ Configuration.unique_in_queue_key_base = key_base
72
+ end
73
+
66
74
  self.uniqueness_configuration = Configuration.new # setup defaults
67
75
 
68
76
  module_function(:in_queue_unique_log,
@@ -71,6 +79,8 @@ module Resque
71
79
  :uniqueness_configure,
72
80
  :uniqueness_config_reset,
73
81
  :uniqueness_log_level,
74
- :uniqueness_log_level=)
82
+ :uniqueness_log_level=,
83
+ :unique_in_queue_key_base,
84
+ :unique_in_queue_key_base=)
75
85
  end
76
86
  end
@@ -8,16 +8,20 @@ module Resque
8
8
 
9
9
  attr_accessor :logger,
10
10
  :log_level,
11
- :unique_in_queue_key_base,
12
11
  :lock_after_execution_period,
13
12
  :ttl,
14
13
  :debug_mode
14
+
15
+ class << self
16
+ attr_accessor :unique_in_queue_key_base
17
+ end
18
+ # Normally isn't set per job, so it can match across all queued jobs.
19
+ @unique_in_queue_key_base = DEFAULT_IN_QUEUE_KEY_BASE
20
+
15
21
  def initialize(**options)
16
22
  @logger = options.key?(:logger) ? options[:logger] : Logger.new(STDOUT)
17
23
  @log_level = options.key?(:log_level) ? options[:log_level] : :debug
18
-
19
- # Can't be set per job:
20
- @unique_in_queue_key_base = options.key?(:unique_in_queue_key_base) ? options[:unique_in_queue_key_base] : DEFAULT_IN_QUEUE_KEY_BASE
24
+ @unique_in_queue_key_base = options.key?(:unique_in_queue_key_base) ? options[:unique_in_queue_key_base] : nil
21
25
 
22
26
  # Can be set per each job:
23
27
  @lock_after_execution_period = options.key?(:lock_after_execution_period) ? options[:lock_after_execution_period] : DEFAULT_LOCK_AFTER_EXECUTION_PERIOD
@@ -38,6 +42,10 @@ module Resque
38
42
  Resque::UniqueInQueue.in_queue_unique_log(msg, self)
39
43
  end
40
44
 
45
+ def unique_in_queue_key_base
46
+ @unique_in_queue_key_base || self.class.unique_in_queue_key_base
47
+ end
48
+
41
49
  def to_hash
42
50
  {
43
51
  logger: logger,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Resque
4
4
  module UniqueInQueue
5
- VERSION = '1.0.2'.freeze
5
+ VERSION = '1.0.3'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-unique_in_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling