resque-unique_at_runtime 3.0.1 → 3.0.2

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: 66b655bcc2e814543c5faff1fd736b3064d0e4bdc63fe9aa5b21e177213e13f5
4
- data.tar.gz: a50033a081961bc72febdfed19f83d79be0fc7ca54b0907e775e9af62b9d48bf
3
+ metadata.gz: 3a8a2e4eac00952a8cccc8cbc74b2b7f4bdbdf7c594f1a0e62891436c0a0c8f8
4
+ data.tar.gz: f25b46513a61c07c9c37bf6af101ca4504b4e25534ac7842ea3885b2a5a30a4b
5
5
  SHA512:
6
- metadata.gz: 66376f37249d17ba9c78e85c11e183b563e1ca7b2ccf214ffdce939b522f16ddfeb29f8b59b9173b6be800c4c42cc38ea72a45530bd649ec45612d73e43ae2c2
7
- data.tar.gz: c9c6a1103ce7df14959c6803809bcab42848ce34412ef1e9e67d01b7f5a3b2804c48bd5be4f7a2695111b67a7709055583c471d96ce4b675983e696f819a1aac
6
+ metadata.gz: aa08c400e7ad45f3265ad39dd01fb0cdcdd9ea8891bbbf88671972d4625c289cf15d01e7609d56b06a7dafbac0687f19acdf3ceeb54106438cdde231823bdf77
7
+ data.tar.gz: 5eee11d58a60feb72ff8585286f19954d6c1c779d1a33288f4d52a5bd54ad08e961226af72c7a559811269c6de1c918c83f505cd6c492caa6bdec0a29b10f70b
@@ -10,14 +10,20 @@ module Resque
10
10
 
11
11
  attr_accessor :logger,
12
12
  :log_level,
13
- :unique_at_runtime_key_base,
14
13
  :lock_timeout,
15
14
  :requeue_interval,
16
15
  :debug_mode
16
+
17
+ class << self
18
+ attr_accessor :unique_at_runtime_key_base
19
+ end
20
+ # Normally isn't set per job, so it will match across all runtime jobs.
21
+ @unique_at_runtime_key_base = DEFAULT_AT_RUNTIME_KEY_BASE
22
+
17
23
  def initialize(**options)
18
24
  @logger = options.key?(:logger) ? options[:logger] : Logger.new(STDOUT)
19
25
  @log_level = options.key?(:log_level) ? options[:log_level] : :debug
20
- @unique_at_runtime_key_base = options.key?(:unique_at_runtime_key_base) ? options[:unique_at_runtime_key_base] : DEFAULT_AT_RUNTIME_KEY_BASE
26
+ @unique_at_runtime_key_base = options.key?(:unique_at_runtime_key_base) ? options[:unique_at_runtime_key_base] : nil
21
27
  @lock_timeout = options.key?(:lock_timeout) ? options[:lock_timeout] : DEFAULT_LOCK_TIMEOUT
22
28
  @requeue_interval = options.key?(:requeue_interval) ? options[:requeue_interval] : DEFAULT_REQUEUE_INTERVAL
23
29
  env_debug = ENV['RESQUE_DEBUG']
@@ -36,6 +42,10 @@ module Resque
36
42
  Resque::UniqueAtRuntime.runtime_unique_log(msg, self)
37
43
  end
38
44
 
45
+ def unique_at_runtime_key_base
46
+ @unique_at_runtime_key_base || self.class.unique_at_runtime_key_base
47
+ end
48
+
39
49
  def to_hash
40
50
  {
41
51
  logger: logger,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Resque
4
4
  module UniqueAtRuntime
5
- VERSION = '3.0.1'
5
+ VERSION = '3.0.2'
6
6
  end
7
7
  end
@@ -61,6 +61,14 @@ module Resque
61
61
  @uniqueness_configuration.log_level = log_level
62
62
  end
63
63
 
64
+ def unique_at_runtime_key_base
65
+ Configuration.unique_at_runtime_key_base
66
+ end
67
+
68
+ def unique_at_runtime_key_base=(key_base)
69
+ Configuration.unique_at_runtime_key_base = key_base
70
+ end
71
+
64
72
  self.uniqueness_configuration = Configuration.new # setup defaults
65
73
 
66
74
  module_function(:runtime_unique_log,
@@ -69,6 +77,8 @@ module Resque
69
77
  :uniqueness_configure,
70
78
  :uniqueness_config_reset,
71
79
  :uniqueness_log_level,
72
- :uniqueness_log_level=)
80
+ :uniqueness_log_level=,
81
+ :unique_at_runtime_key_base,
82
+ :unique_at_runtime_key_base=)
73
83
  end
74
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-unique_at_runtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling