redis_queued_locks 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.claude/project-overview.md +216 -25
- data/.claude/rules/acquirer.md +6 -5
- data/.claude/rules/arguments.md +2 -2
- data/.claude/rules/changelog.md +27 -0
- data/.claude/rules/git.md +1 -1
- data/.claude/rules/logic.md +10 -12
- data/.claude/rules/swarm.md +3 -4
- data/.claude/rules/tests.md +6 -6
- data/.claude/rules/type-checking.md +13 -14
- data/.claude/rules/visitors.md +5 -5
- data/.claude/skills/rql-code-review/SKILL.md +112 -35
- data/CHANGELOG.md +98 -244
- data/CLAUDE.md +9 -8
- data/README.md +275 -85
- data/Rakefile +11 -0
- data/lib/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rb +28 -12
- data/lib/redis_queued_locks/acquirer/acquire_lock/log_visitor.rb +38 -16
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rb +92 -15
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rb +430 -63
- data/lib/redis_queued_locks/acquirer/acquire_lock.rb +72 -22
- data/lib/redis_queued_locks/acquirer/clear_dead_requests.rb +240 -45
- data/lib/redis_queued_locks/acquirer/extend_lock_ttl.rb +3 -1
- data/lib/redis_queued_locks/acquirer/keys.rb +6 -2
- data/lib/redis_queued_locks/acquirer/lock_series_poc/instr_visitor.rb +10 -5
- data/lib/redis_queued_locks/acquirer/lock_series_poc/log_visitor.rb +18 -9
- data/lib/redis_queued_locks/acquirer/lock_series_poc.rb +52 -23
- data/lib/redis_queued_locks/acquirer/locks.rb +6 -2
- data/lib/redis_queued_locks/acquirer/queue_info.rb +30 -7
- data/lib/redis_queued_locks/acquirer/queues.rb +17 -6
- data/lib/redis_queued_locks/acquirer/release_all_locks.rb +6 -2
- data/lib/redis_queued_locks/acquirer/release_locks_of.rb +6 -2
- data/lib/redis_queued_locks/client.rb +66 -24
- data/lib/redis_queued_locks/config.rb +93 -1
- data/lib/redis_queued_locks/resource.rb +124 -9
- data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +6 -5
- data/lib/redis_queued_locks/swarm/zombie_info.rb +6 -2
- data/lib/redis_queued_locks/version.rb +2 -2
- data/rbs_collection.lock.yaml +4 -0
- data/rbs_collection.yaml +2 -1
- data/sig/manifest.yml +1 -0
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rbs +12 -6
- data/sig/redis_queued_locks/acquirer/acquire_lock/log_visitor.rbs +21 -14
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rbs +61 -40
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rbs +59 -11
- data/sig/redis_queued_locks/acquirer/acquire_lock/{yield_with_expire → yield_expire}/log_visitor.rbs +4 -4
- data/sig/redis_queued_locks/acquirer/acquire_lock/yield_expire.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock.rbs +5 -3
- data/sig/redis_queued_locks/acquirer/clear_dead_requests.rbs +14 -1
- data/sig/redis_queued_locks/acquirer/extend_lock_ttl.rbs +2 -2
- data/sig/redis_queued_locks/acquirer/queues.rbs +1 -1
- data/sig/redis_queued_locks/client.rbs +10 -7
- data/sig/redis_queued_locks/config.rbs +54 -1
- data/sig/redis_queued_locks/instrument/sampler.rbs +3 -1
- data/sig/redis_queued_locks/instrument/void_notifier.rbs +3 -1
- data/sig/redis_queued_locks/logging/sampler.rbs +3 -1
- data/sig/redis_queued_locks/resource.rbs +22 -12
- data/sig/redis_queued_locks/swarm/swarm_element/threaded.rbs +1 -1
- data/sig/redis_queued_locks/utilities.rbs +2 -1
- data/sig/redis_queued_locks.rbs +7 -0
- metadata +4 -3
- /data/sig/redis_queued_locks/{acquier.rbs → acquirer.rbs} +0 -0
data/Rakefile
CHANGED
|
@@ -55,4 +55,15 @@ end
|
|
|
55
55
|
RSpec::Core::RakeTask.new(:rspec)
|
|
56
56
|
Steep::RakeTask.new(:steep)
|
|
57
57
|
|
|
58
|
+
# NOTE: (parallel specs) the runner: `spec/support/parallel_runner.rb`
|
|
59
|
+
namespace :rspec do
|
|
60
|
+
desc 'Run the specs in parallel processes (WORKERS=<n>, each worker with its own Redis databases)'
|
|
61
|
+
task :parallel, [:paths] do |_task, args|
|
|
62
|
+
require_relative 'spec/support/parallel_runner'
|
|
63
|
+
|
|
64
|
+
workers = ENV.key?('WORKERS') ? Integer(ENV.fetch('WORKERS')) : nil
|
|
65
|
+
RQLParallelSpecs.run(workers, args[:paths].to_s.split)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
58
69
|
task default: :rspec
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# @api private
|
|
4
4
|
# @since 1.7.0
|
|
5
|
-
# @version 1.
|
|
5
|
+
# @version 1.22.0
|
|
6
6
|
# rubocop:disable Metrics/ModuleLength
|
|
7
7
|
module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
8
8
|
# rubocop:disable Metrics/ClassLength
|
|
@@ -11,6 +11,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
11
11
|
# @param instr_sampled [Boolean]
|
|
12
12
|
# @param lock_key [String]
|
|
13
13
|
# @param rw_mode [Symbol]
|
|
14
|
+
# @param priority [Integer] The lock request priority.
|
|
14
15
|
# @param ttl [Integer, NilClass]
|
|
15
16
|
# @param acq_id [String]
|
|
16
17
|
# @param hst_id [String]
|
|
@@ -21,12 +22,13 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
21
22
|
#
|
|
22
23
|
# @api private
|
|
23
24
|
# @since 1.7.0
|
|
24
|
-
# @version 1.
|
|
25
|
+
# @version 1.22.0
|
|
25
26
|
def extendable_reentrant_lock_obtained(
|
|
26
27
|
instrumenter,
|
|
27
28
|
instr_sampled,
|
|
28
29
|
lock_key,
|
|
29
30
|
rw_mode,
|
|
31
|
+
priority,
|
|
30
32
|
ttl,
|
|
31
33
|
acq_id,
|
|
32
34
|
hst_id,
|
|
@@ -36,7 +38,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
36
38
|
)
|
|
37
39
|
return unless instr_sampled
|
|
38
40
|
instrumenter.notify('redis_queued_locks.extendable_reentrant_lock_obtained', {
|
|
39
|
-
lock_key:, rw_mode:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
41
|
+
lock_key:, rw_mode:, priority:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
40
42
|
}) rescue nil
|
|
41
43
|
end
|
|
42
44
|
|
|
@@ -44,6 +46,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
44
46
|
# @param instr_sampled [Boolean]
|
|
45
47
|
# @param lock_key [String]
|
|
46
48
|
# @param rw_mode [Symbol]
|
|
49
|
+
# @param priority [Integer] The lock request priority.
|
|
47
50
|
# @param ttl [Integer, NilClass]
|
|
48
51
|
# @param acq_id [String]
|
|
49
52
|
# @param hst_id [String]
|
|
@@ -54,12 +57,13 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
54
57
|
#
|
|
55
58
|
# @api private
|
|
56
59
|
# @since 1.7.0
|
|
57
|
-
# @version 1.
|
|
60
|
+
# @version 1.22.0
|
|
58
61
|
def reentrant_lock_obtained(
|
|
59
62
|
instrumenter,
|
|
60
63
|
instr_sampled,
|
|
61
64
|
lock_key,
|
|
62
65
|
rw_mode,
|
|
66
|
+
priority,
|
|
63
67
|
ttl,
|
|
64
68
|
acq_id,
|
|
65
69
|
hst_id,
|
|
@@ -69,7 +73,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
69
73
|
)
|
|
70
74
|
return unless instr_sampled
|
|
71
75
|
instrumenter.notify('redis_queued_locks.reentrant_lock_obtained', {
|
|
72
|
-
lock_key:, rw_mode:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
76
|
+
lock_key:, rw_mode:, priority:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
73
77
|
}) rescue nil
|
|
74
78
|
end
|
|
75
79
|
|
|
@@ -77,6 +81,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
77
81
|
# @param instr_sampled [Boolean]
|
|
78
82
|
# @param lock_key [String]
|
|
79
83
|
# @param rw_mode [Symbol]
|
|
84
|
+
# @param priority [Integer] The lock request priority.
|
|
80
85
|
# @param ttl [Integer, NilClass]
|
|
81
86
|
# @param acq_id [String]
|
|
82
87
|
# @param hst_id [String]
|
|
@@ -87,12 +92,13 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
87
92
|
#
|
|
88
93
|
# @api private
|
|
89
94
|
# @since 1.7.0
|
|
90
|
-
# @version 1.
|
|
95
|
+
# @version 1.22.0
|
|
91
96
|
def lock_obtained(
|
|
92
97
|
instrumenter,
|
|
93
98
|
instr_sampled,
|
|
94
99
|
lock_key,
|
|
95
100
|
rw_mode,
|
|
101
|
+
priority,
|
|
96
102
|
ttl,
|
|
97
103
|
acq_id,
|
|
98
104
|
hst_id,
|
|
@@ -102,7 +108,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
102
108
|
)
|
|
103
109
|
return unless instr_sampled
|
|
104
110
|
instrumenter.notify('redis_queued_locks.lock_obtained', {
|
|
105
|
-
lock_key:, rw_mode:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
111
|
+
lock_key:, rw_mode:, priority:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
106
112
|
}) rescue nil
|
|
107
113
|
end
|
|
108
114
|
|
|
@@ -110,6 +116,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
110
116
|
# @param instr_sampled [Boolean]
|
|
111
117
|
# @param lock_key [String]
|
|
112
118
|
# @param rw_mode [Symbol]
|
|
119
|
+
# @param priority [Integer] The lock request priority.
|
|
113
120
|
# @param ttl [Integer, NilClass]
|
|
114
121
|
# @param acq_id [String]
|
|
115
122
|
# @param hst_id [String]
|
|
@@ -121,12 +128,13 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
121
128
|
#
|
|
122
129
|
# @api private
|
|
123
130
|
# @since 1.7.0
|
|
124
|
-
# @version 1.
|
|
131
|
+
# @version 1.22.0
|
|
125
132
|
def reentrant_lock_hold_completes(
|
|
126
133
|
instrumenter,
|
|
127
134
|
instr_sampled,
|
|
128
135
|
lock_key,
|
|
129
136
|
rw_mode,
|
|
137
|
+
priority,
|
|
130
138
|
ttl,
|
|
131
139
|
acq_id,
|
|
132
140
|
hst_id,
|
|
@@ -137,7 +145,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
137
145
|
)
|
|
138
146
|
return unless instr_sampled
|
|
139
147
|
instrumenter.notify('redis_queued_locks.reentrant_lock_hold_completes', {
|
|
140
|
-
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, rw_mode:, acq_time:,
|
|
148
|
+
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, rw_mode:, priority:, acq_time:,
|
|
149
|
+
instrument:
|
|
141
150
|
}) rescue nil
|
|
142
151
|
end
|
|
143
152
|
|
|
@@ -145,6 +154,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
145
154
|
# @param instr_sampled [Boolean]
|
|
146
155
|
# @param lock_key [String]
|
|
147
156
|
# @param rw_mode [Symbol]
|
|
157
|
+
# @param priority [Integer] The lock request priority.
|
|
148
158
|
# @param ttl [Integer, NilClass]
|
|
149
159
|
# @param acq_id [String]
|
|
150
160
|
# @param hst_id [String]
|
|
@@ -156,12 +166,13 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
156
166
|
#
|
|
157
167
|
# @api private
|
|
158
168
|
# @since 1.7.0
|
|
159
|
-
# @version 1.
|
|
169
|
+
# @version 1.22.0
|
|
160
170
|
def lock_hold_and_release(
|
|
161
171
|
instrumenter,
|
|
162
172
|
instr_sampled,
|
|
163
173
|
lock_key,
|
|
164
174
|
rw_mode,
|
|
175
|
+
priority,
|
|
165
176
|
ttl,
|
|
166
177
|
acq_id,
|
|
167
178
|
hst_id,
|
|
@@ -172,7 +183,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
172
183
|
)
|
|
173
184
|
return unless instr_sampled
|
|
174
185
|
instrumenter.notify('redis_queued_locks.lock_hold_and_release', {
|
|
175
|
-
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, rw_mode:, acq_time:,
|
|
186
|
+
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, rw_mode:, priority:, acq_time:,
|
|
187
|
+
instrument:
|
|
176
188
|
}) rescue nil
|
|
177
189
|
end
|
|
178
190
|
|
|
@@ -183,6 +195,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
183
195
|
# @param instr_sampled [Boolean]
|
|
184
196
|
# @param lock_key [String]
|
|
185
197
|
# @param rw_mode [Symbol]
|
|
198
|
+
# @param priority [Integer] The lock request priority.
|
|
186
199
|
# @param ttl [Integer]
|
|
187
200
|
# @param acq_id [String]
|
|
188
201
|
# @param hst_id [String]
|
|
@@ -194,11 +207,13 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
194
207
|
#
|
|
195
208
|
# @api private
|
|
196
209
|
# @since 1.21.0
|
|
210
|
+
# @version 1.22.0
|
|
197
211
|
def lock_obtaining_failed(
|
|
198
212
|
instrumenter,
|
|
199
213
|
instr_sampled,
|
|
200
214
|
lock_key,
|
|
201
215
|
rw_mode,
|
|
216
|
+
priority,
|
|
202
217
|
ttl,
|
|
203
218
|
acq_id,
|
|
204
219
|
hst_id,
|
|
@@ -209,7 +224,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
209
224
|
)
|
|
210
225
|
return unless instr_sampled
|
|
211
226
|
instrumenter.notify('redis_queued_locks.lock_obtaining_failed', {
|
|
212
|
-
lock_key:, rw_mode:, ttl:, acq_id:, hst_id:, ts:, acq_time:, result:,
|
|
227
|
+
lock_key:, rw_mode:, priority:, ttl:, acq_id:, hst_id:, ts:, acq_time:, result:,
|
|
228
|
+
instrument:
|
|
213
229
|
}) rescue nil
|
|
214
230
|
end
|
|
215
231
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# @api private
|
|
4
4
|
# @since 1.7.0
|
|
5
|
-
# @version 1.
|
|
5
|
+
# @version 1.22.0
|
|
6
6
|
# rubocop:disable Metrics/ModuleLength
|
|
7
7
|
module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
8
8
|
# rubocop:disable Metrics/ClassLength
|
|
@@ -15,11 +15,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
15
15
|
# @param host_id [String]
|
|
16
16
|
# @param access_strategy [Symbol]
|
|
17
17
|
# @param rw_mode [Symbol]
|
|
18
|
+
# @param priority [Integer] The lock request priority.
|
|
18
19
|
# @return [void]
|
|
19
20
|
#
|
|
20
21
|
# @api private
|
|
21
22
|
# @since 1.7.0
|
|
22
|
-
# @version 1.
|
|
23
|
+
# @version 1.22.0
|
|
23
24
|
def start_lock_obtaining(
|
|
24
25
|
logger,
|
|
25
26
|
log_sampled,
|
|
@@ -28,7 +29,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
28
29
|
acquirer_id,
|
|
29
30
|
host_id,
|
|
30
31
|
access_strategy,
|
|
31
|
-
rw_mode
|
|
32
|
+
rw_mode,
|
|
33
|
+
priority
|
|
32
34
|
)
|
|
33
35
|
return unless log_sampled
|
|
34
36
|
|
|
@@ -39,7 +41,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
39
41
|
"acq_id => '#{acquirer_id}' " \
|
|
40
42
|
"hst_id => '#{host_id}' " \
|
|
41
43
|
"acs_strat => '#{access_strategy}' " \
|
|
42
|
-
"rw_mode => '#{rw_mode}'"
|
|
44
|
+
"rw_mode => '#{rw_mode}' " \
|
|
45
|
+
"priority => #{priority}"
|
|
43
46
|
end rescue nil
|
|
44
47
|
end
|
|
45
48
|
|
|
@@ -51,11 +54,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
51
54
|
# @param host_id [String]
|
|
52
55
|
# @param access_strategy [Symbol]
|
|
53
56
|
# @param rw_mode [Symbol]
|
|
57
|
+
# @param priority [Integer] The lock request priority.
|
|
54
58
|
# @return [void]
|
|
55
59
|
#
|
|
56
60
|
# @api private
|
|
57
61
|
# @since 1.7.0
|
|
58
|
-
# @version 1.
|
|
62
|
+
# @version 1.22.0
|
|
59
63
|
def start_try_to_lock_cycle(
|
|
60
64
|
logger,
|
|
61
65
|
log_sampled,
|
|
@@ -64,7 +68,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
64
68
|
acquirer_id,
|
|
65
69
|
host_id,
|
|
66
70
|
access_strategy,
|
|
67
|
-
rw_mode
|
|
71
|
+
rw_mode,
|
|
72
|
+
priority
|
|
68
73
|
)
|
|
69
74
|
return unless log_sampled
|
|
70
75
|
|
|
@@ -75,7 +80,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
75
80
|
"acq_id => '#{acquirer_id}' " \
|
|
76
81
|
"hst_id => '#{host_id}' " \
|
|
77
82
|
"acs_strat => '#{access_strategy}' " \
|
|
78
|
-
"rw_mode => '#{rw_mode}'"
|
|
83
|
+
"rw_mode => '#{rw_mode}' " \
|
|
84
|
+
"priority => #{priority}"
|
|
79
85
|
end rescue nil
|
|
80
86
|
end
|
|
81
87
|
|
|
@@ -87,11 +93,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
87
93
|
# @param host_id [String]
|
|
88
94
|
# @param access_strategy [Symbol]
|
|
89
95
|
# @param rw_mode [Symbol]
|
|
96
|
+
# @param priority [Integer] The lock request priority.
|
|
90
97
|
# @return [void]
|
|
91
98
|
#
|
|
92
99
|
# @api private
|
|
93
100
|
# @since 1.7.0
|
|
94
|
-
# @version 1.
|
|
101
|
+
# @version 1.22.0
|
|
95
102
|
def dead_score_reached__reset_acquirer_position(
|
|
96
103
|
logger,
|
|
97
104
|
log_sampled,
|
|
@@ -100,7 +107,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
100
107
|
acquirer_id,
|
|
101
108
|
host_id,
|
|
102
109
|
access_strategy,
|
|
103
|
-
rw_mode
|
|
110
|
+
rw_mode,
|
|
111
|
+
priority
|
|
104
112
|
)
|
|
105
113
|
return unless log_sampled
|
|
106
114
|
|
|
@@ -111,7 +119,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
111
119
|
"acq_id => '#{acquirer_id}' " \
|
|
112
120
|
"hst_id => '#{host_id}' " \
|
|
113
121
|
"acs_strat => '#{access_strategy}' " \
|
|
114
|
-
"rw_mode => '#{rw_mode}'"
|
|
122
|
+
"rw_mode => '#{rw_mode}' " \
|
|
123
|
+
"priority => #{priority}"
|
|
115
124
|
end rescue nil
|
|
116
125
|
end
|
|
117
126
|
|
|
@@ -124,11 +133,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
124
133
|
# @param acq_time [Numeric]
|
|
125
134
|
# @param access_strategy [Symbol]
|
|
126
135
|
# @param rw_mode [Symbol]
|
|
136
|
+
# @param priority [Integer] The lock request priority.
|
|
127
137
|
# @return [void]
|
|
128
138
|
#
|
|
129
139
|
# @api private
|
|
130
140
|
# @since 1.7.0
|
|
131
|
-
# @version 1.
|
|
141
|
+
# @version 1.22.0
|
|
132
142
|
def extendable_reentrant_lock_obtained(
|
|
133
143
|
logger,
|
|
134
144
|
log_sampled,
|
|
@@ -138,7 +148,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
138
148
|
host_id,
|
|
139
149
|
acq_time,
|
|
140
150
|
access_strategy,
|
|
141
|
-
rw_mode
|
|
151
|
+
rw_mode,
|
|
152
|
+
priority
|
|
142
153
|
)
|
|
143
154
|
return unless log_sampled
|
|
144
155
|
|
|
@@ -150,6 +161,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
150
161
|
"hst_id => '#{host_id}' " \
|
|
151
162
|
"acs_strat => '#{access_strategy}' " \
|
|
152
163
|
"rw_mode => '#{rw_mode}' " \
|
|
164
|
+
"priority => #{priority} " \
|
|
153
165
|
"acq_time => #{acq_time} (ms)"
|
|
154
166
|
end rescue nil
|
|
155
167
|
end
|
|
@@ -163,11 +175,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
163
175
|
# @param acq_time [Numeric]
|
|
164
176
|
# @param access_strategy [Symbol]
|
|
165
177
|
# @param rw_mode [Symbol]
|
|
178
|
+
# @param priority [Integer] The lock request priority.
|
|
166
179
|
# @return [void]
|
|
167
180
|
#
|
|
168
181
|
# @api private
|
|
169
182
|
# @since 1.7.0
|
|
170
|
-
# @version 1.
|
|
183
|
+
# @version 1.22.0
|
|
171
184
|
def reentrant_lock_obtained(
|
|
172
185
|
logger,
|
|
173
186
|
log_sampled,
|
|
@@ -177,7 +190,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
177
190
|
host_id,
|
|
178
191
|
acq_time,
|
|
179
192
|
access_strategy,
|
|
180
|
-
rw_mode
|
|
193
|
+
rw_mode,
|
|
194
|
+
priority
|
|
181
195
|
)
|
|
182
196
|
return unless log_sampled
|
|
183
197
|
|
|
@@ -189,6 +203,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
189
203
|
"hst_id => '#{host_id}' " \
|
|
190
204
|
"acs_strat => '#{access_strategy}' " \
|
|
191
205
|
"rw_mode => '#{rw_mode}' " \
|
|
206
|
+
"priority => #{priority} " \
|
|
192
207
|
"acq_time => #{acq_time} (ms)"
|
|
193
208
|
end rescue nil
|
|
194
209
|
end
|
|
@@ -202,11 +217,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
202
217
|
# @param acq_time [Numeric]
|
|
203
218
|
# @param access_strategy [Symbol]
|
|
204
219
|
# @param rw_mode [Symbol]
|
|
220
|
+
# @param priority [Integer] The lock request priority.
|
|
205
221
|
# @return [void]
|
|
206
222
|
#
|
|
207
223
|
# @api private
|
|
208
224
|
# @since 1.7.0
|
|
209
|
-
# @version 1.
|
|
225
|
+
# @version 1.22.0
|
|
210
226
|
def lock_obtained(
|
|
211
227
|
logger,
|
|
212
228
|
log_sampled,
|
|
@@ -216,7 +232,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
216
232
|
host_id,
|
|
217
233
|
acq_time,
|
|
218
234
|
access_strategy,
|
|
219
|
-
rw_mode
|
|
235
|
+
rw_mode,
|
|
236
|
+
priority
|
|
220
237
|
)
|
|
221
238
|
return unless log_sampled
|
|
222
239
|
|
|
@@ -228,6 +245,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
228
245
|
"hst_id => '#{host_id}' " \
|
|
229
246
|
"acs_strat => '#{access_strategy}' " \
|
|
230
247
|
"rw_mode => '#{rw_mode}' " \
|
|
248
|
+
"priority => #{priority} " \
|
|
231
249
|
"acq_time => #{acq_time} (ms)"
|
|
232
250
|
end rescue nil
|
|
233
251
|
end
|
|
@@ -244,11 +262,13 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
244
262
|
# @param acq_time [Numeric]
|
|
245
263
|
# @param access_strategy [Symbol]
|
|
246
264
|
# @param rw_mode [Symbol]
|
|
265
|
+
# @param priority [Integer] The lock request priority.
|
|
247
266
|
# @param result [Symbol] The failure result (`:timeout_reached`, `:retry_limit_reached`, ...).
|
|
248
267
|
# @return [void]
|
|
249
268
|
#
|
|
250
269
|
# @api private
|
|
251
270
|
# @since 1.21.0
|
|
271
|
+
# @version 1.22.0
|
|
252
272
|
def lock_obtaining_failed(
|
|
253
273
|
logger,
|
|
254
274
|
log_sampled,
|
|
@@ -259,6 +279,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
259
279
|
acq_time,
|
|
260
280
|
access_strategy,
|
|
261
281
|
rw_mode,
|
|
282
|
+
priority,
|
|
262
283
|
result
|
|
263
284
|
)
|
|
264
285
|
return unless log_sampled
|
|
@@ -271,6 +292,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
271
292
|
"hst_id => '#{host_id}' " \
|
|
272
293
|
"acs_strat => '#{access_strategy}' " \
|
|
273
294
|
"rw_mode => '#{rw_mode}' " \
|
|
295
|
+
"priority => #{priority} " \
|
|
274
296
|
"acq_time => #{acq_time} (ms) " \
|
|
275
297
|
"result => '#{result}'"
|
|
276
298
|
end rescue nil
|