redis_queued_locks 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +0 -5
- data/lib/redis_queued_locks/acquier.rb +7 -9
- data/lib/redis_queued_locks/client.rb +0 -2
- 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: 1679387f2a006dbec9a7f6de25c26b368edceb7ff09c494171abfa0b5dbea561
|
4
|
+
data.tar.gz: 516fba25423990d1e0fc5136183a9f33c4e2302958545a1e5eb765bddd757067
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca4bff8702c1272f1d467e80c6328bdfcc28f56d6e799c55f5177d57c7ff76219bb968285633102e9733fa054323dd2f3c9693d60d38ed452174c1836ecfa00e
|
7
|
+
data.tar.gz: e4ebc007351b5691c14d06b9f99aba5963bbc98458aa90dd763a563265861b16151e4a060707b8208f544d697394ecd0cd0e98218fbec332c8ac01455aed403b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -95,10 +95,6 @@ clinet = RedisQueuedLocks::Client.new(redis_client) do |config|
|
|
95
95
|
# - nil means "no timeout" and you are only limited by "retry_count" config;
|
96
96
|
config.try_to_lock_timeout = 10
|
97
97
|
|
98
|
-
# (milliseconds) (default: 1)
|
99
|
-
# - expiration precision. affects the ttl (ttl + precision);
|
100
|
-
config.exp_precision = 1
|
101
|
-
|
102
98
|
# (milliseconds) (default: 5_000)
|
103
99
|
# - lock's time to live
|
104
100
|
config.default_lock_ttl = 5_000
|
@@ -150,7 +146,6 @@ end
|
|
150
146
|
- If block is passed the obtained lock will be released after the block execution or the lock's ttl (what will happen first);
|
151
147
|
- If block is not passed the obtained lock will be released after lock's ttl;
|
152
148
|
|
153
|
-
|
154
149
|
```ruby
|
155
150
|
def lock(
|
156
151
|
lock_name,
|
@@ -18,14 +18,11 @@ module RedisQueuedLocks::Acquier
|
|
18
18
|
# @since 0.1.0
|
19
19
|
extend Release
|
20
20
|
|
21
|
-
# @return [Integer]
|
22
|
-
# Redis expiration deviation in milliseconds:
|
23
|
-
# -> 1 millisecond: for Redis's deviation;
|
24
|
-
# -> 1 millisecond: for RubyVM's processing deviation;
|
21
|
+
# @return [Integer] Redis expiration error in milliseconds.
|
25
22
|
#
|
26
23
|
# @api private
|
27
24
|
# @since 0.1.0
|
28
|
-
|
25
|
+
REDIS_EXPIRE_ERROR = 1
|
29
26
|
|
30
27
|
# rubocop:disable Metrics/ClassLength
|
31
28
|
class << self
|
@@ -95,7 +92,10 @@ module RedisQueuedLocks::Acquier
|
|
95
92
|
ractor_id,
|
96
93
|
identity
|
97
94
|
)
|
98
|
-
|
95
|
+
# NOTE:
|
96
|
+
# - think aobut the redis expiration error
|
97
|
+
# - (ttl - REDIS_EXPIRE_ERROR).yield_self { |val| (val == 0) ? ttl : val }
|
98
|
+
lock_ttl = ttl
|
99
99
|
lock_key = RedisQueuedLocks::Resource.prepare_lock_key(lock_name)
|
100
100
|
lock_key_queue = RedisQueuedLocks::Resource.prepare_lock_queue(lock_name)
|
101
101
|
acquier_position = RedisQueuedLocks::Resource.calc_initial_acquier_position
|
@@ -410,9 +410,7 @@ module RedisQueuedLocks::Acquier
|
|
410
410
|
#
|
411
411
|
# @api private
|
412
412
|
# @since 0.1.0
|
413
|
-
def extend_lock_ttl(redis_client, lock_name, milliseconds)
|
414
|
-
|
415
|
-
end
|
413
|
+
def extend_lock_ttl(redis_client, lock_name, milliseconds); end
|
416
414
|
|
417
415
|
private
|
418
416
|
|
@@ -12,7 +12,6 @@ class RedisQueuedLocks::Client
|
|
12
12
|
setting :retry_delay, 200 # NOTE: milliseconds
|
13
13
|
setting :retry_jitter, 50 # NOTE: milliseconds
|
14
14
|
setting :try_to_lock_timeout, 10 # NOTE: seconds
|
15
|
-
setting :exp_precision, 1 # NOTE: milliseconds
|
16
15
|
setting :default_lock_ttl, 5_000 # NOTE: milliseconds
|
17
16
|
setting :default_queue_ttl, 15 # NOTE: seconds
|
18
17
|
setting :lock_release_batch_size, 100
|
@@ -26,7 +25,6 @@ class RedisQueuedLocks::Client
|
|
26
25
|
validate('retry_delay', :integer)
|
27
26
|
validate('retry_jitter', :integer)
|
28
27
|
validate('try_to_lock_timeout') { |val| val == nil || (val.is_a?(::Integer) && val >= 0) }
|
29
|
-
validate('exp_precision', :integer)
|
30
28
|
validate('default_lock_tt', :integer)
|
31
29
|
validate('default_queue_ttl', :integer)
|
32
30
|
validate('lock_release_batch_size', :integer)
|