redis_queued_locks 0.0.11 → 0.0.13
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/CHANGELOG.md +8 -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: '0067915f812330a031b51bc20300a13eee31aa2628aa2b26c90524c58d80ab60'
|
4
|
+
data.tar.gz: f322cbff42c80656ad09d075008c48461db991c153ab04b42e4187f54bcc6bce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbe61d02314ec926529a30cb3771903199897b798f386ff6a5ebb562d3857b92c11d5579a4d6cc9219fa64e152ff1e4f6aeb1ceb98cf8eae094c443b8ec2f6b9
|
7
|
+
data.tar.gz: 3462b766ffb13ca57d21caa7d4725b076a3dc6c594601288f8c7593cb496f58d3ce4b66082035d8ab4bbfa3eba395db475995cacb3a4eb588b03ab06a25eef27
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.0.13] - 2024-02-27
|
4
|
+
### Changed
|
5
|
+
- Minor development updates;
|
6
|
+
|
7
|
+
## [0.0.12] - 2024-02-27
|
8
|
+
### Changed
|
9
|
+
- Deleted `redis expiration error` (1 millisecond time drift) from lock ttl calculation;
|
10
|
+
|
3
11
|
## [0.0.11] - 2024-02-27
|
4
12
|
### Changed
|
5
13
|
- Minor documentation updates;
|
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)
|