redis_queued_locks 0.0.22 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +15 -0
- data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock.rb +98 -71
- data/lib/redis_queued_locks/acquier/acquire_lock/yield_with_expire.rb +1 -1
- data/lib/redis_queued_locks/acquier/acquire_lock.rb +9 -2
- data/lib/redis_queued_locks/acquier/extend_lock_ttl.rb +1 -1
- data/lib/redis_queued_locks/acquier/release_all_locks.rb +22 -20
- data/lib/redis_queued_locks/acquier/release_lock.rb +6 -4
- data/lib/redis_queued_locks/client.rb +15 -1
- data/lib/redis_queued_locks/logging.rb +1 -1
- data/lib/redis_queued_locks/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0c873b666d2c9f618789e6ef957e1ce7375da840bcbc1ce797d9e457bcc7d72
|
4
|
+
data.tar.gz: 9f9c4637fae7ca1a1e8bdc247e23f5c11977af7962f545ae084d05126106dad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06c3a4ee60f8c5da6d9272ed99bff10315496c79e6c922431529b7f34da896e17fb08c73b389080f82c54e3714d89780950517e3beff469661bbbf6c4bdbaf0e
|
7
|
+
data.tar.gz: a0d7c9287c0a22923f2ddd4573ec6be63c0e274cff23fb5b2744b9cbd44368b7803b1ced3ffe9eefc53f0f2f23729177641535835bb6f97ede5f79074a308c4f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.0.24] - 2024-03-21
|
4
|
+
### Added
|
5
|
+
- An optional ability to log each try of lock obtaining (see `RedisQueuedLocks::Acquier::AcquireLock::TryToLock.try_to_lock`);
|
6
|
+
|
7
|
+
## [0.0.23] - 2024-03-21
|
8
|
+
### Changed
|
9
|
+
- Composed redis commands are invoked on the one conenction
|
10
|
+
(instead of mutiple connection fetchiong from redis connection pool on each redis command);
|
11
|
+
|
3
12
|
## [0.0.22] - 2024-03-21
|
4
13
|
### Added
|
5
14
|
- Logging infrastructure. Initial implementation includes the only debugging features.
|
data/README.md
CHANGED
@@ -144,6 +144,11 @@ clinet = RedisQueuedLocks::Client.new(redis_client) do |config|
|
|
144
144
|
# - start of the lock expiration after `yield`: "[redis_queud_locks.expire_lock] lock_key => 'rql:lock:your_lock'"
|
145
145
|
# - by default uses VoidLogger that does nothing;
|
146
146
|
config.logger = RedisQueuedLocks::Logging::VoidLogger
|
147
|
+
|
148
|
+
# (default: false)
|
149
|
+
# - should be logged the each try of lock acquiring (a lot of logs can be generated depending on your retry configurations);
|
150
|
+
# - if logger is not cofnigured this option does not lead to any effect;
|
151
|
+
config.log_lock_try = false
|
147
152
|
end
|
148
153
|
```
|
149
154
|
|
@@ -187,6 +192,8 @@ def lock(
|
|
187
192
|
fail_fast: false,
|
188
193
|
identity: uniq_identity, # (attr_accessor) calculated during client instantiation via config[:uniq_identifier] proc;
|
189
194
|
metadata: nil,
|
195
|
+
logger: config[:logger],
|
196
|
+
log_lock_try: config[:log_lock_try],
|
190
197
|
&block
|
191
198
|
)
|
192
199
|
```
|
@@ -224,6 +231,12 @@ def lock(
|
|
224
231
|
ivar (accessed via `uniq_dentity` accessor method);
|
225
232
|
- `metadata` - `[NilClass,Any]`
|
226
233
|
- A custom metadata wich will be passed to the instrumenter's payload with `:meta` key;
|
234
|
+
- `logger` - `[::Logger,#debug]`
|
235
|
+
- Logger object used from the configuration layer (see config[:logger]);
|
236
|
+
- See `RedisQueuedLocks::Logging::VoidLogger` for example;
|
237
|
+
- `log_lock_try` - `[Boolean]`
|
238
|
+
- should be logged the each try of lock acquiring (a lot of logs can be generated depending on your retry configurations);
|
239
|
+
- see `config[:log_lock_try]`;
|
227
240
|
- `block` - `[Block]`
|
228
241
|
- A block of code that should be executed after the successfully acquired lock.
|
229
242
|
- If block is **passed** the obtained lock will be released after the block execution or it's ttl (what will happen first);
|
@@ -278,6 +291,8 @@ def lock!(
|
|
278
291
|
identity: uniq_identity,
|
279
292
|
fail_fast: false,
|
280
293
|
metadata: nil,
|
294
|
+
logger: config[:logger],
|
295
|
+
log_lock_try: config[:log_lock_try],
|
281
296
|
&block
|
282
297
|
)
|
283
298
|
```
|
@@ -2,8 +2,14 @@
|
|
2
2
|
|
3
3
|
# @api private
|
4
4
|
# @since 0.1.0
|
5
|
+
# rubocop:disable Metrics/ModuleLength
|
5
6
|
module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
|
7
|
+
# @since 0.1.0
|
8
|
+
extend RedisQueuedLocks::Utilities
|
9
|
+
|
6
10
|
# @param redis [RedisClient]
|
11
|
+
# @param logger [::Logger,#debug]
|
12
|
+
# @param log_lock_try [Boolean]
|
7
13
|
# @param lock_key [String]
|
8
14
|
# @param lock_key_queue [String]
|
9
15
|
# @param acquier_id [String]
|
@@ -18,6 +24,8 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
|
|
18
24
|
# rubocop:disable Metrics/MethodLength
|
19
25
|
def try_to_lock(
|
20
26
|
redis,
|
27
|
+
logger,
|
28
|
+
log_lock_try,
|
21
29
|
lock_key,
|
22
30
|
lock_key_queue,
|
23
31
|
acquier_id,
|
@@ -30,96 +38,114 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
|
|
30
38
|
inter_result = nil
|
31
39
|
timestamp = nil
|
32
40
|
|
41
|
+
if log_lock_try
|
42
|
+
run_non_critical do
|
43
|
+
logger.debug("[redis_queued_locks.try_lock_start] lock_key => '#{lock_key}'")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
33
47
|
# Step 0: watch the lock key changes (and discard acquirement if lock is already acquired)
|
34
|
-
result = redis.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
'ZREMRANGEBYSCORE',
|
50
|
-
lock_key_queue,
|
51
|
-
'-inf',
|
52
|
-
RedisQueuedLocks::Resource.acquier_dead_score(queue_ttl)
|
53
|
-
)
|
54
|
-
|
55
|
-
RedisQueuedLocks.debug(
|
56
|
-
"Step №2: дропаем из очереди просроченных ожидающих. [ZREMRANGE: #{res}]"
|
57
|
-
)
|
58
|
-
|
59
|
-
# Step 3: get the actual acquier waiting in the queue
|
60
|
-
waiting_acquier = Array(redis.call('ZRANGE', lock_key_queue, '0', '0')).first
|
61
|
-
|
62
|
-
RedisQueuedLocks.debug(
|
63
|
-
"Step №3: какой процесс в очереди сейчас ждет. " \
|
64
|
-
"[ZRANGE <следующий процесс>: #{waiting_acquier} :: <текущий процесс>: #{acquier_id}]"
|
65
|
-
)
|
66
|
-
|
67
|
-
# Step 4: check the actual acquier: is it ours? are we aready to lock?
|
68
|
-
unless waiting_acquier == acquier_id
|
69
|
-
# Step ROLLBACK 1.1: our time hasn't come yet. retry!
|
48
|
+
result = redis.with do |rconn|
|
49
|
+
if log_lock_try
|
50
|
+
run_non_critical do
|
51
|
+
logger.debug("[redis_queued_locks.try_lock_rconn_fetched] lock_key => '#{lock_key}'")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
rconn.multi(watch: [lock_key]) do |transact|
|
56
|
+
# Fast-Step X0: fail-fast check
|
57
|
+
if fail_fast && rconn.call('HGET', lock_key, 'acq_id')
|
58
|
+
# Fast-Step X1: is lock already obtained. fail fast - no try.
|
59
|
+
inter_result = :fail_fast_no_try
|
60
|
+
else
|
61
|
+
# Step 1: add an acquier to the lock acquirement queue
|
62
|
+
res = rconn.call('ZADD', lock_key_queue, 'NX', acquier_position, acquier_id)
|
70
63
|
|
71
64
|
RedisQueuedLocks.debug(
|
72
|
-
"Step
|
73
|
-
"[Ждет: #{waiting_acquier}. А нужен: #{acquier_id}]"
|
65
|
+
"Step №1: добавление в очередь (#{acquier_id}). [ZADD to the queue: #{res}]"
|
74
66
|
)
|
75
67
|
|
76
|
-
|
77
|
-
|
78
|
-
|
68
|
+
# Step 2.1: drop expired acquiers from the lock queue
|
69
|
+
res = rconn.call(
|
70
|
+
'ZREMRANGEBYSCORE',
|
71
|
+
lock_key_queue,
|
72
|
+
'-inf',
|
73
|
+
RedisQueuedLocks::Resource.acquier_dead_score(queue_ttl)
|
74
|
+
)
|
79
75
|
|
80
|
-
|
81
|
-
|
76
|
+
RedisQueuedLocks.debug(
|
77
|
+
"Step №2: дропаем из очереди просроченных ожидающих. [ZREMRANGE: #{res}]"
|
78
|
+
)
|
79
|
+
|
80
|
+
# Step 3: get the actual acquier waiting in the queue
|
81
|
+
waiting_acquier = Array(rconn.call('ZRANGE', lock_key_queue, '0', '0')).first
|
82
82
|
|
83
83
|
RedisQueuedLocks.debug(
|
84
|
-
"
|
85
|
-
"[
|
86
|
-
"#{(locked_by_acquier == nil) ? 'не занят' : "занят процессом <#{locked_by_acquier}>"}"
|
84
|
+
"Step №3: какой процесс в очереди сейчас ждет. " \
|
85
|
+
"[ZRANGE <следующий процесс>: #{waiting_acquier} :: <текущий процесс>: #{acquier_id}]"
|
87
86
|
)
|
88
87
|
|
89
|
-
|
90
|
-
|
88
|
+
# Step 4: check the actual acquier: is it ours? are we aready to lock?
|
89
|
+
unless waiting_acquier == acquier_id
|
90
|
+
# Step ROLLBACK 1.1: our time hasn't come yet. retry!
|
91
91
|
|
92
92
|
RedisQueuedLocks.debug(
|
93
|
-
"Step ROLLBACK №
|
94
|
-
"[
|
93
|
+
"Step ROLLBACK №1: не одинаковые ключи. выходим. " \
|
94
|
+
"[Ждет: #{waiting_acquier}. А нужен: #{acquier_id}]"
|
95
95
|
)
|
96
96
|
|
97
|
-
inter_result = :
|
97
|
+
inter_result = :acquier_is_not_first_in_queue
|
98
98
|
else
|
99
|
-
# NOTE:
|
100
|
-
|
101
|
-
# Step 6.1: remove our acquier from waiting queue
|
102
|
-
transact.call('ZPOPMIN', lock_key_queue, '1')
|
99
|
+
# NOTE: our time has come! let's try to acquire the lock!
|
103
100
|
|
104
|
-
|
105
|
-
|
106
|
-
)
|
101
|
+
# Step 5: check if the our lock is already acquired
|
102
|
+
locked_by_acquier = rconn.call('HGET', lock_key, 'acq_id')
|
107
103
|
|
104
|
+
# rubocop:disable Layout/LineLength
|
108
105
|
RedisQueuedLocks.debug(
|
109
|
-
"
|
106
|
+
"Ste №5: Ищем требуемый лок. " \
|
107
|
+
"[HGET<#{lock_key}>: " \
|
108
|
+
"#{(locked_by_acquier == nil) ? 'не занят' : "занят процессом <#{locked_by_acquier}>"}"
|
110
109
|
)
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
110
|
+
# rubocop:enable Layout/LineLength
|
111
|
+
|
112
|
+
if locked_by_acquier
|
113
|
+
# Step ROLLBACK 2: required lock is stil acquired. retry!
|
114
|
+
|
115
|
+
RedisQueuedLocks.debug(
|
116
|
+
"Step ROLLBACK №2: Ключ уже занят. Ничего не делаем. " \
|
117
|
+
"[Занят процессом: #{locked_by_acquier}]"
|
118
|
+
)
|
119
|
+
|
120
|
+
inter_result = :lock_is_still_acquired
|
121
|
+
else
|
122
|
+
# NOTE: required lock is free and ready to be acquired! acquire!
|
123
|
+
|
124
|
+
# Step 6.1: remove our acquier from waiting queue
|
125
|
+
transact.call('ZPOPMIN', lock_key_queue, '1')
|
126
|
+
|
127
|
+
RedisQueuedLocks.debug(
|
128
|
+
'Step №4: Забираем наш текущий процесс из очереди. [ZPOPMIN]'
|
129
|
+
)
|
130
|
+
|
131
|
+
# rubocop:disable Layout/LineLength
|
132
|
+
RedisQueuedLocks.debug(
|
133
|
+
"===> <FINAL> Step №6: закрепляем лок за процессом [HSET<#{lock_key}>: #{acquier_id}]"
|
134
|
+
)
|
135
|
+
# rubocop:enable Layout/LineLength
|
136
|
+
|
137
|
+
# Step 6.2: acquire a lock and store an info about the acquier
|
138
|
+
transact.call(
|
139
|
+
'HSET',
|
140
|
+
lock_key,
|
141
|
+
'acq_id', acquier_id,
|
142
|
+
'ts', (timestamp = Time.now.to_i),
|
143
|
+
'ini_ttl', ttl
|
144
|
+
)
|
145
|
+
|
146
|
+
# Step 6.3: set the lock expiration time in order to prevent "infinite locks"
|
147
|
+
transact.call('PEXPIRE', lock_key, ttl) # NOTE: in milliseconds
|
148
|
+
end
|
123
149
|
end
|
124
150
|
end
|
125
151
|
end
|
@@ -176,3 +202,4 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
|
|
176
202
|
RedisQueuedLocks::Data[ok: true, result: result]
|
177
203
|
end
|
178
204
|
end
|
205
|
+
# rubocop:enable Metrics/ModuleLength
|
@@ -7,7 +7,7 @@ module RedisQueuedLocks::Acquier::AcquireLock::YieldWithExpire
|
|
7
7
|
extend RedisQueuedLocks::Utilities
|
8
8
|
|
9
9
|
# @param redis [RedisClient] Redis connection manager.
|
10
|
-
# @param logger [
|
10
|
+
# @param logger [::Logger,#debug] Logger object.
|
11
11
|
# @param lock_key [String] Lock key to be expired.
|
12
12
|
# @param timed [Boolean] Should the lock be wrapped by Tiemlout with with lock's ttl
|
13
13
|
# @param ttl_shift [Float] Lock's TTL shifting. Should affect block's ttl. In millisecodns.
|
@@ -69,9 +69,13 @@ module RedisQueuedLocks::Acquier::AcquireLock
|
|
69
69
|
# already obtained.
|
70
70
|
# @option metadata [NilClass,Any]
|
71
71
|
# - A custom metadata wich will be passed to the instrumenter's payload with :meta key;
|
72
|
-
# @option logger [
|
73
|
-
# - Logger object used from
|
72
|
+
# @option logger [::Logger,#debug]
|
73
|
+
# - Logger object used from the configuration layer (see config[:logger]);
|
74
74
|
# - See RedisQueuedLocks::Logging::VoidLogger for example;
|
75
|
+
# @option log_lock_try [Boolean]
|
76
|
+
# - should be logged the each try of lock acquiring (a lot of logs can be generated depending
|
77
|
+
# on your retry configurations);
|
78
|
+
# - see `config[:log_lock_try]`;
|
75
79
|
# @param [Block]
|
76
80
|
# A block of code that should be executed after the successfully acquired lock.
|
77
81
|
# @return [RedisQueuedLocks::Data,Hash<Symbol,Any>,yield]
|
@@ -100,6 +104,7 @@ module RedisQueuedLocks::Acquier::AcquireLock
|
|
100
104
|
fail_fast:,
|
101
105
|
metadata:,
|
102
106
|
logger:,
|
107
|
+
log_lock_try:,
|
103
108
|
&block
|
104
109
|
)
|
105
110
|
# Step 1: prepare lock requirements (generate lock name, calc lock ttl, etc).
|
@@ -146,6 +151,8 @@ module RedisQueuedLocks::Acquier::AcquireLock
|
|
146
151
|
while acq_process[:should_try]
|
147
152
|
try_to_lock(
|
148
153
|
redis,
|
154
|
+
logger,
|
155
|
+
log_lock_try,
|
149
156
|
lock_key,
|
150
157
|
lock_key_queue,
|
151
158
|
acquier_id,
|
@@ -17,7 +17,7 @@ module RedisQueuedLocks::Acquier::ReleaseAllLocks
|
|
17
17
|
# The number of lock keys that should be released in a time.
|
18
18
|
# @param isntrumenter [#notify]
|
19
19
|
# See RedisQueuedLocks::Instrument::ActiveSupport for example.
|
20
|
-
# @param logger [
|
20
|
+
# @param logger [::Logger,#debug]
|
21
21
|
# - Logger object used from `configuration` layer (see config[:logger]);
|
22
22
|
# - See RedisQueuedLocks::Logging::VoidLogger for example;
|
23
23
|
# @return [RedisQueuedLocks::Data,Hash<Symbol,Any>]
|
@@ -57,26 +57,28 @@ module RedisQueuedLocks::Acquier::ReleaseAllLocks
|
|
57
57
|
# @api private
|
58
58
|
# @since 0.1.0
|
59
59
|
def fully_release_all_locks(redis, batch_size)
|
60
|
-
result = redis.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
60
|
+
result = redis.with do |rconn|
|
61
|
+
rconn.pipelined do |pipeline|
|
62
|
+
# Step A: release all queus and their related locks
|
63
|
+
rconn.scan(
|
64
|
+
'MATCH',
|
65
|
+
RedisQueuedLocks::Resource::LOCK_QUEUE_PATTERN,
|
66
|
+
count: batch_size
|
67
|
+
) do |lock_queue|
|
68
|
+
# TODO: reduce unnecessary iterations
|
69
|
+
pipeline.call('ZREMRANGEBYSCORE', lock_queue, '-inf', '+inf')
|
70
|
+
pipeline.call('EXPIRE', RedisQueuedLocks::Resource.lock_key_from_queue(lock_queue), '0')
|
71
|
+
end
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
# Step B: release all locks
|
74
|
+
rconn.scan(
|
75
|
+
'MATCH',
|
76
|
+
RedisQueuedLocks::Resource::LOCK_PATTERN,
|
77
|
+
count: batch_size
|
78
|
+
) do |lock_key|
|
79
|
+
# TODO: reduce unnecessary iterations
|
80
|
+
pipeline.call('EXPIRE', lock_key, '0')
|
81
|
+
end
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
@@ -20,7 +20,7 @@ module RedisQueuedLocks::Acquier::ReleaseLock
|
|
20
20
|
# The lock name that should be released.
|
21
21
|
# @param isntrumenter [#notify]
|
22
22
|
# See RedisQueuedLocks::Instrument::ActiveSupport for example.
|
23
|
-
# @param logger [
|
23
|
+
# @param logger [::Logger,#debug]
|
24
24
|
# - Logger object used from `configuration` layer (see config[:logger]);
|
25
25
|
# - See RedisQueuedLocks::Logging::VoidLogger for example;
|
26
26
|
# @return [RedisQueuedLocks::Data,Hash<Symbol,Any>]
|
@@ -65,9 +65,11 @@ module RedisQueuedLocks::Acquier::ReleaseLock
|
|
65
65
|
# @api private
|
66
66
|
# @since 0.1.0
|
67
67
|
def fully_release_lock(redis, lock_key, lock_key_queue)
|
68
|
-
result = redis.
|
69
|
-
|
70
|
-
|
68
|
+
result = redis.with do |rconn|
|
69
|
+
rconn.multi do |transact|
|
70
|
+
transact.call('ZREMRANGEBYSCORE', lock_key_queue, '-inf', '+inf')
|
71
|
+
transact.call('EXPIRE', lock_key, '0')
|
72
|
+
end
|
71
73
|
end
|
72
74
|
|
73
75
|
RedisQueuedLocks::Data[ok: true, result:]
|
@@ -19,6 +19,7 @@ class RedisQueuedLocks::Client
|
|
19
19
|
setting :instrumenter, RedisQueuedLocks::Instrument::VoidNotifier
|
20
20
|
setting :uniq_identifier, -> { RedisQueuedLocks::Resource.calc_uniq_identity }
|
21
21
|
setting :logger, RedisQueuedLocks::Logging::VoidLogger
|
22
|
+
setting :log_lock_try, false
|
22
23
|
|
23
24
|
validate('retry_count') { |val| val == nil || (val.is_a?(::Integer) && val >= 0) }
|
24
25
|
validate('retry_delay') { |val| val.is_a?(::Integer) && val >= 0 }
|
@@ -28,8 +29,9 @@ class RedisQueuedLocks::Client
|
|
28
29
|
validate('default_queue_ttl', :integer)
|
29
30
|
validate('lock_release_batch_size', :integer)
|
30
31
|
validate('instrumenter') { |val| RedisQueuedLocks::Instrument.valid_interface?(val) }
|
31
|
-
validate('logger') { |val| RedisQueuedLocks::Logging.valid_interface?(val) }
|
32
32
|
validate('uniq_identifier', :proc)
|
33
|
+
validate('logger') { |val| RedisQueuedLocks::Logging.valid_interface?(val) }
|
34
|
+
validate('log_lock_try', :boolean)
|
33
35
|
end
|
34
36
|
|
35
37
|
# @return [RedisClient]
|
@@ -93,6 +95,13 @@ class RedisQueuedLocks::Client
|
|
93
95
|
# by another process while the lock request queue was initially empty;
|
94
96
|
# @option metadata [NilClass,Any]
|
95
97
|
# - A custom metadata wich will be passed to the instrumenter's payload with :meta key;
|
98
|
+
# @option logger [::Logger,#debug]
|
99
|
+
# - Logger object used from the configuration layer (see config[:logger]);
|
100
|
+
# - See `RedisQueuedLocks::Logging::VoidLogger` for example;
|
101
|
+
# @option log_lock_try [Boolean]
|
102
|
+
# - should be logged the each try of lock acquiring (a lot of logs can
|
103
|
+
# be generated depending on your retry configurations);
|
104
|
+
# - see `config[:log_lock_try]`;
|
96
105
|
# @param block [Block]
|
97
106
|
# A block of code that should be executed after the successfully acquired lock.
|
98
107
|
# @return [RedisQueuedLocks::Data,Hash<Symbol,Any>,yield]
|
@@ -114,6 +123,8 @@ class RedisQueuedLocks::Client
|
|
114
123
|
fail_fast: false,
|
115
124
|
identity: uniq_identity,
|
116
125
|
metadata: nil,
|
126
|
+
logger: config[:logger],
|
127
|
+
log_lock_try: config[:log_lock_try],
|
117
128
|
&block
|
118
129
|
)
|
119
130
|
RedisQueuedLocks::Acquier::AcquireLock.acquire_lock(
|
@@ -136,6 +147,7 @@ class RedisQueuedLocks::Client
|
|
136
147
|
fail_fast:,
|
137
148
|
metadata:,
|
138
149
|
logger: config[:logger],
|
150
|
+
log_lock_try: config[:log_lock_try],
|
139
151
|
&block
|
140
152
|
)
|
141
153
|
end
|
@@ -156,6 +168,8 @@ class RedisQueuedLocks::Client
|
|
156
168
|
fail_fast: false,
|
157
169
|
identity: uniq_identity,
|
158
170
|
metadata: nil,
|
171
|
+
logger: config[:logger],
|
172
|
+
log_lock_try: config[:log_lock_try],
|
159
173
|
&block
|
160
174
|
)
|
161
175
|
lock(
|