redis_queued_locks 0.0.11 → 0.0.13

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: 98c4154b27f6f87e29870ca00e4372d70243dcb528311030a7715de138cb2039
4
- data.tar.gz: 0b7fe57e396bb7f13932417e963a5a53f530255db525dcf3d261d41e08a8396a
3
+ metadata.gz: '0067915f812330a031b51bc20300a13eee31aa2628aa2b26c90524c58d80ab60'
4
+ data.tar.gz: f322cbff42c80656ad09d075008c48461db991c153ab04b42e4187f54bcc6bce
5
5
  SHA512:
6
- metadata.gz: 7a441b4848cb2471f694dc8f7f17e6471bf5f7957a5e37eadcdd0da23a4b0d50e3183575530fc764d5e262eea0898699b584393674a994411c7bd6ec18e02a81
7
- data.tar.gz: 362ffaf848de14c6e42f79822a2e41a39f02b88aad8d5abb1ed79df235ffbb2dc7c42063bb6bee2aab5b9b7fc2d836498446734ee64b8d31001445ca3430e6f9
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
- REDIS_EXPIRATION_DEVIATION = 2 # NOTE: milliseconds
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
- lock_ttl = ttl + REDIS_EXPIRATION_DEVIATION
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)
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 0.0.11
9
- VERSION = '0.0.11'
8
+ # @version 0.0.13
9
+ VERSION = '0.0.13'
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_queued_locks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov