redis_queued_locks 1.14.0 → 1.15.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7924e5055147fe7c2e0ff65e59ca7e82dc0ae81ce2c880cced9c914307fb1821
4
- data.tar.gz: e6921c3d151ae3d227ad130989562f96266954c47c8358ecd82f76afc922c362
3
+ metadata.gz: 5d3c20255c1b685b5f7fbb2d9441808cb6e8522e231e9eafa84dac0b7a968a9c
4
+ data.tar.gz: d1dd021fa7b303f1066fc942cd1a8df70869585b80ca8a88bb1e5c69de364192
5
5
  SHA512:
6
- metadata.gz: e0b1deaefb5638a96392c759a903661ad3175e45b128e605f0939889c56974c6f6ea2f887884a883fcd8843aec5423bd384a7c8d24644a42ff4e0c6737e0340e
7
- data.tar.gz: ffaea4bd5b9c57802b99c754e2defb6e16ad9cff3e82855b4a8e6e3f93538ba648dbc84f3cd85200017f47bbc9f4d26a7bbb5d910776c79b19adbc02e5a002ed
6
+ metadata.gz: e3671472cd833f8a53f10f2bb2a7ae5dcb29f3d48edae159b72e50db25c7a63d80c7e062663fcffb5512001e8198a2aebdec9e8f36414b13785684b762309905
7
+ data.tar.gz: cf5ede3990749e71137e9c12a63a6f588595db40d4971f76f0fedeb0c72d0343a7c7df14d26952e1a0eeb467de509115d6bbfe723628403e6321a549252d0a1a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.15.0] - 2025-10-17
4
+ ### Changed
5
+ - `"redis_queud_locks.release_locks_of"` instrumentation event payload now includes `hst_id` and `acq_id`;
6
+
3
7
  ## [1.14.0] - 2025-10-17
4
8
  ### Added
5
9
  - `#clear_locks_of`/`#release_locks_of`
@@ -271,17 +275,17 @@
271
275
 
272
276
  ## [0.0.31] - 2024-03-25
273
277
  ### Changed
274
- - `:metadata` renamed to `:instrument` in order to reflect it's domain area;
278
+ - `:metadata` renamed to `:instrument` in order to reflect its domain area;
275
279
  - `:metadata` is renamed to `:meta` and reserved for future updates;
276
280
 
277
281
  ## [0.0.30] - 2024-03-23
278
282
  ### Fixed
279
283
  - Re-enqueue problem: fixed a problem when the expired lock requests were infinitly re-added to the lock queue
280
284
  and immediately removed from the lock queue rather than being re-positioned. It happens when the lock request
281
- ttl reached the queue ttl, and the new request now had the dead score forever (fix: it's score now will be correctly
285
+ ttl reached the queue ttl, and the new request now had the dead score forever (fix: its score now will be correctly
282
286
  recalculated from the current time at the dead score time moment);
283
287
  ### Added
284
- - Logging: more detailed logs to the `RedisQueuedLocks::Acquier::AcquierLock` logic and it's sub-modules:
288
+ - Logging: more detailed logs to the `RedisQueuedLocks::Acquier::AcquierLock` logic and its sub-modules:
285
289
  - added new logs;
286
290
  - added `queue_ttl` to each log;
287
291
 
data/README.md CHANGED
@@ -104,7 +104,7 @@ Provides flexible invocation flow, parametrized limits (lock request ttl, lock t
104
104
 
105
105
  <sup>\[[back to top](#table-of-contents)\]</sup>
106
106
 
107
- > Each lock request is put into the request queue (each lock is hosted by it's own queue separately from other queues) and processed in order of their priority (FIFO). Each lock request lives some period of time (RTTL) which guarantees that the request queue will never be stacked.
107
+ > Each lock request is put into the request queue (each lock is hosted by its own queue separately from other queues) and processed in order of their priority (FIFO). Each lock request lives some period of time (RTTL) which guarantees that the request queue will never be stacked.
108
108
 
109
109
  > In addition to the classic "queued" (FIFO) strategy RQL supports "random" (RANDOM) lock obtaining strategy when any acquirer from the lock queue can obtain the lock regardless the position in the queue.
110
110
 
@@ -577,8 +577,8 @@ def lock(
577
577
  - `false` by default;
578
578
  - `block` - (optional) `[Block]`
579
579
  - A block of code that should be executed after the successfully acquired lock.
580
- - If block is **passed** the obtained lock will be released after the block execution or it's ttl (what will happen first);
581
- - If block is **not passed** the obtained lock will be released after it's ttl;
580
+ - If block is **passed** the obtained lock will be released after the block execution or its ttl (what will happen first);
581
+ - If block is **not passed** the obtained lock will be released after its ttl;
582
582
  - If you want the block to have a TTL too and this TTL to be the same as TTL of the lock
583
583
  use `timed: true` option (`rql.lock("my_lock", timed: true, ttl: 5_000) { ... }`)
584
584
 
@@ -722,7 +722,7 @@ rql.lock_info("my_lock")
722
722
 
723
723
  - (`:queue_ttl`) setting a short limit of time to the lock request queue position (if a process fails to acquire
724
724
  the lock within this period of time (and before timeout/retry_count limits occurs of course) -
725
- it's lock request will be moved to the end of queue):
725
+ its lock request will be moved to the end of queue):
726
726
 
727
727
  ```ruby
728
728
  rql.lock("my_lock", queue_ttl: 5, timeout: 10_000, retry_count: nil)
@@ -1596,7 +1596,7 @@ Accepts:
1596
1596
  - `:dead_ttl` - (optional) `[Integer]`
1597
1597
  - lock request ttl after which a lock request is considered dead;
1598
1598
  - has a preconfigured value in `config['dead_request_ttl']` (1 day by default);
1599
- - `:sacn_size` - (optional) `[Integer]`
1599
+ - `:scan_size` - (optional) `[Integer]`
1600
1600
  - the batch of scanned keys for Redis'es SCAN command;
1601
1601
  - has a preconfigured valie in `config['lock_release_batch_size']`;
1602
1602
  - `:logger` - (optional) `[::Logger,#debug]`
@@ -2286,13 +2286,15 @@ Detalized event semantics and payload structure:
2286
2286
 
2287
2287
  ##### `"redis_queued_locks.release_locks_of"`
2288
2288
  - <sup>\[[back to the list](#instrumentation-events)\]</sup>
2289
- - an event signalizes about the released locks of the cocnrete host and acquirer;
2289
+ - an event signalizes about the released locks (and removement from lock queues) of the concrete host and acquirer;
2290
2290
  - raised from `#clear_locks_of` and `#clear_current_locks` (`#release_locks_of` and `#release_current_locks` respectively);
2291
2291
  - payload:
2292
2292
  - `:rel_time` - `float`/`milliseconds` - time spent on "release locks of" operation;
2293
2293
  - `:at` - `float`/`epoch` - the time when the opertaion has ended;
2294
+ - `:acq_id` - `string` - refused acquirer identifier;
2295
+ - `:hst_id` - `string` - refused host identifier;
2294
2296
  - `:rel_key_cnt` - `integer` - released locks count;
2295
- - `:tch_queue_cnt` - `:integer` - the number of queues from which the cocnrete host/acquirer was removed;
2297
+ - `:tch_queue_cnt` - `:integer` - the number of queues from which the concrete host/acquirer was removed;
2296
2298
 
2297
2299
  ---
2298
2300
 
@@ -2355,7 +2357,7 @@ Detalized event semantics and payload structure:
2355
2357
  - `unlock_on:`-option in lock/lock! logic in order to support auto-unlocking on any exception rasaied under the invoked block (invoked under the lock);
2356
2358
  - **Research**: support for `Valkey` database backend (https://github.com/valkey-io/valkey) (https://valkey.io/);
2357
2359
  - **Research**: support for `Garnet` database backend (https://microsoft.github.io/) (https://github.com/microsoft/garnet);
2358
- - add a library-level exception, when RQL-related key in Redis (required for it's logic) has incompatible type (means: some other program uses our key with their own type and logic and RQL can't work properly);
2360
+ - add a library-level exception, when RQL-related key in Redis (required for its logic) has incompatible type (means: some other program uses our key with their own type and logic and RQL can't work properly);
2359
2361
  ---
2360
2362
 
2361
2363
  ## Build and Develop
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- redis_queued_locks (1.13.0)
4
+ redis_queued_locks (1.15.0)
5
5
  redis-client (~> 0.20)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (8.0.2)
10
+ activesupport (8.0.3)
11
11
  base64
12
12
  benchmark (>= 0.3)
13
13
  bigdecimal
@@ -34,10 +34,10 @@ GEM
34
34
  ast (2.4.3)
35
35
  base64 (0.3.0)
36
36
  benchmark (0.4.1)
37
- bigdecimal (3.2.1)
37
+ bigdecimal (3.3.1)
38
38
  coderay (1.1.3)
39
39
  concurrent-ruby (1.3.5)
40
- connection_pool (2.5.3)
40
+ connection_pool (2.5.4)
41
41
  csv (3.3.5)
42
42
  diff-lcs (1.6.2)
43
43
  docile (1.4.1)
@@ -56,7 +56,7 @@ GEM
56
56
  fileutils (1.7.3)
57
57
  i18n (1.14.7)
58
58
  concurrent-ruby (~> 1.0)
59
- json (2.12.2)
59
+ json (2.15.1)
60
60
  language_server-protocol (3.17.0.5)
61
61
  lint_roller (1.1.0)
62
62
  listen (3.9.0)
@@ -64,43 +64,43 @@ GEM
64
64
  rb-inotify (~> 0.9, >= 0.9.10)
65
65
  logger (1.7.0)
66
66
  method_source (1.1.0)
67
- minitest (5.25.5)
67
+ minitest (5.26.0)
68
68
  mutex_m (0.3.0)
69
69
  parallel (1.27.0)
70
- parser (3.3.8.0)
70
+ parser (3.3.9.0)
71
71
  ast (~> 2.4.1)
72
72
  racc
73
- prism (1.4.0)
73
+ prism (1.6.0)
74
74
  pry (0.15.2)
75
75
  coderay (~> 1.1)
76
76
  method_source (~> 1.0)
77
77
  racc (1.8.1)
78
- rack (3.1.15)
78
+ rack (3.2.3)
79
79
  rainbow (3.1.1)
80
80
  rake (13.3.0)
81
81
  rb-fsevent (0.11.2)
82
82
  rb-inotify (0.11.1)
83
83
  ffi (~> 1.0)
84
- rbs (3.9.4)
84
+ rbs (3.9.5)
85
85
  logger
86
- redis-client (0.24.0)
86
+ redis-client (0.26.1)
87
87
  connection_pool
88
- regexp_parser (2.10.0)
88
+ regexp_parser (2.11.3)
89
89
  rspec (3.13.1)
90
90
  rspec-core (~> 3.13.0)
91
91
  rspec-expectations (~> 3.13.0)
92
92
  rspec-mocks (~> 3.13.0)
93
- rspec-core (3.13.4)
93
+ rspec-core (3.13.5)
94
94
  rspec-support (~> 3.13.0)
95
95
  rspec-expectations (3.13.5)
96
96
  diff-lcs (>= 1.2.0, < 2.0)
97
97
  rspec-support (~> 3.13.0)
98
- rspec-mocks (3.13.5)
98
+ rspec-mocks (3.13.6)
99
99
  diff-lcs (>= 1.2.0, < 2.0)
100
100
  rspec-support (~> 3.13.0)
101
101
  rspec-retry (0.6.2)
102
102
  rspec-core (> 3.3)
103
- rspec-support (3.13.4)
103
+ rspec-support (3.13.6)
104
104
  rubocop (1.75.7)
105
105
  json (~> 2.3)
106
106
  language_server-protocol (~> 3.17.0.2)
@@ -112,7 +112,7 @@ GEM
112
112
  rubocop-ast (>= 1.44.0, < 2.0)
113
113
  ruby-progressbar (~> 1.7)
114
114
  unicode-display_width (>= 2.4.0, < 4.0)
115
- rubocop-ast (1.44.1)
115
+ rubocop-ast (1.47.1)
116
116
  parser (>= 3.3.7.2)
117
117
  prism (~> 1.4)
118
118
  rubocop-capybara (2.22.1)
@@ -155,8 +155,8 @@ GEM
155
155
  docile (~> 1.1)
156
156
  simplecov-html (~> 0.11)
157
157
  simplecov_json_formatter (~> 0.1)
158
- simplecov-html (0.13.1)
159
- simplecov-lcov (0.8.0)
158
+ simplecov-html (0.13.2)
159
+ simplecov-lcov (0.9.0)
160
160
  simplecov_json_formatter (0.1.4)
161
161
  steep (1.10.0)
162
162
  activesupport (>= 5.1)
@@ -180,10 +180,10 @@ GEM
180
180
  unicode-display_width (>= 1.1.1, < 4)
181
181
  tzinfo (2.0.6)
182
182
  concurrent-ruby (~> 1.0)
183
- unicode-display_width (3.1.4)
184
- unicode-emoji (~> 4.0, >= 4.0.4)
185
- unicode-emoji (4.0.4)
186
- uri (1.0.3)
183
+ unicode-display_width (3.2.0)
184
+ unicode-emoji (~> 4.1)
185
+ unicode-emoji (4.1.0)
186
+ uri (1.0.4)
187
187
  zlib (3.2.1)
188
188
 
189
189
  PLATFORMS
@@ -214,4 +214,4 @@ DEPENDENCIES
214
214
  steep
215
215
 
216
216
  BUNDLED WITH
217
- 2.6.9
217
+ 2.7.2
@@ -73,10 +73,18 @@ module RedisQueuedLocks::Acquirer::ReleaseLocksOf
73
73
  # despite the enabled instrumentation sampling;
74
74
  # - makes sense when instrumentation sampling is enabled;
75
75
  # @return [Hash<Symbol,Any>]
76
- # Format: { ok: true, result: Hash<Symbol,Numeric> }
76
+ # Format: {
77
+ # ok: true,
78
+ # result: {
79
+ # rel_key_cnt: Integer,
80
+ # tch_queue_cnt: Integer,
81
+ # rel_time: Numeric
82
+ # }
83
+ # }
77
84
  #
78
85
  # @api private
79
86
  # @since 1.14.0
87
+ # @version 1.15.0
80
88
  # rubocop:disable Metrics/MethodLength
81
89
  def release_locks_of(
82
90
  refused_host_id,
@@ -125,6 +133,8 @@ module RedisQueuedLocks::Acquirer::ReleaseLocksOf
125
133
  run_non_critical do
126
134
  instrumenter.notify('redis_queued_locks.release_locks_of', {
127
135
  at: time_at,
136
+ hst_id: refused_host_id,
137
+ acq_id: refused_acquirer_id,
128
138
  rel_time: rel_time,
129
139
  rel_key_cnt: result[:rel_key_cnt],
130
140
  tch_queue_cnt: result[:tch_queue_cnt]
@@ -158,7 +158,7 @@ class RedisQueuedLocks::Swarm
158
158
  end
159
159
 
160
160
  # @option zombie_ttl [Integer]
161
- # @option lock_sacn_size [Integer]
161
+ # @option lock_scan_size [Integer]
162
162
  # @return [Hash<Symbol,Set<String>>]
163
163
  #
164
164
  # @api public
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 1.14.0
9
- VERSION = '1.14.0'
8
+ # @version 1.15.0
9
+ VERSION = '1.15.0'
10
10
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  "|> Distributed locks with \"prioritized lock acquisition queue\" capabilities " \
19
19
  "based on the Redis Database.\n" \
20
20
  "|> Each lock request is put into the request queue " \
21
- "(each lock is hosted by it's own queue separately from other queues) and processed " \
21
+ "(each lock is hosted by its own queue separately from other queues) and processed " \
22
22
  "in order of their priority (FIFO).\n" \
23
23
  "|> Each lock request lives some period of time (RTTL) " \
24
24
  "(with requeue capabilities) which guarantees the request queue will never be stacked.\n" \
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: 1.14.0
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
@@ -25,7 +25,7 @@ dependencies:
25
25
  version: '0.20'
26
26
  description: |-
27
27
  |> Distributed locks with "prioritized lock acquisition queue" capabilities based on the Redis Database.
28
- |> Each lock request is put into the request queue (each lock is hosted by it's own queue separately from other queues) and processed in order of their priority (FIFO).
28
+ |> Each lock request is put into the request queue (each lock is hosted by its own queue separately from other queues) and processed in order of their priority (FIFO).
29
29
  |> Each lock request lives some period of time (RTTL) (with requeue capabilities) which guarantees the request queue will never be stacked.
30
30
  |> In addition to the classic `queued` (FIFO) strategy RQL supports `random` (RANDOM) lock obtaining strategy when any acquirer from the lock queue can obtain the lock regardless the position in the queue.
31
31
  |> Provides flexible invocation flow, parametrized limits (lock request ttl, lock ttl, queue ttl, lock attempts limit, fast failing, etc), logging and instrumentation.