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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a8a2e4eac00952a8cccc8cbc74b2b7f4bdbdf7c594f1a0e62891436c0a0c8f8
|
4
|
+
data.tar.gz: f25b46513a61c07c9c37bf6af101ca4504b4e25534ac7842ea3885b2a5a30a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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] :
|
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,
|
@@ -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
|