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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e2b27c8cf85da28ed578801b934b56a5865ea25518013b904379faf98f5ee7c
|
4
|
+
data.tar.gz: 2b4cc6f023e5b6c54fe80f5b0adbb026fc93e8510830e5b39f129272d5f3d95d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|