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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98c4154b27f6f87e29870ca00e4372d70243dcb528311030a7715de138cb2039
4
- data.tar.gz: 0b7fe57e396bb7f13932417e963a5a53f530255db525dcf3d261d41e08a8396a
3
+ metadata.gz: 1679387f2a006dbec9a7f6de25c26b368edceb7ff09c494171abfa0b5dbea561
4
+ data.tar.gz: 516fba25423990d1e0fc5136183a9f33c4e2302958545a1e5eb765bddd757067
5
5
  SHA512:
6
- metadata.gz: 7a441b4848cb2471f694dc8f7f17e6471bf5f7957a5e37eadcdd0da23a4b0d50e3183575530fc764d5e262eea0898699b584393674a994411c7bd6ec18e02a81
7
- data.tar.gz: 362ffaf848de14c6e42f79822a2e41a39f02b88aad8d5abb1ed79df235ffbb2dc7c42063bb6bee2aab5b9b7fc2d836498446734ee64b8d31001445ca3430e6f9
6
+ metadata.gz: ca4bff8702c1272f1d467e80c6328bdfcc28f56d6e799c55f5177d57c7ff76219bb968285633102e9733fa054323dd2f3c9693d60d38ed452174c1836ecfa00e
7
+ data.tar.gz: e4ebc007351b5691c14d06b9f99aba5963bbc98458aa90dd763a563265861b16151e4a060707b8208f544d697394ecd0cd0e98218fbec332c8ac01455aed403b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.12] - 2024-02-27
4
+ ### Changed
5
+ - Deleted `redis expiration error` (1 millisecond time drift) from lock ttl calculation;
6
+
3
7
  ## [0.0.11] - 2024-02-27
4
8
  ### Changed
5
9
  - 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.12
9
+ VERSION = '0.0.12'
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.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov