redis_queued_locks 0.0.33 → 0.0.34

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: 43854a2842911dcf40e95329b2631bc6c76cdaff0cd204fb57eff55c0ee461aa
4
- data.tar.gz: c361d55a71ac4c71d307fca4a7182069d055e302ec7b65274bcbc1a4ede6f768
3
+ metadata.gz: 62b1870f7a71fb878167216b1f05a90f82c60b8a0da513dfad1edae8a87618a5
4
+ data.tar.gz: 705c1e47d0f4823e38f749f24e82700ce33d749e187c0ae98ff9bd5ff21aa142
5
5
  SHA512:
6
- metadata.gz: 6887f12891fce49f878427b501980695872e304c1429331d23b251d2f66f2db1f07a0994952f0b4ad6d9ec9b81ea769eaefe09ab1bef0c1abcadc9770ef38344
7
- data.tar.gz: aa2f6d2cfbe72dd6bf5c637f5538ce1df7c8415579505f765b3016a4c243abc52cd1db246f51abba7efa51abef123d577e26bfee992a5484208cb1416ca00f50
6
+ metadata.gz: cba6bd786d8db210d907bd5af41497aa3f34e026f2ecfb87f53e857f91d2278109c116a91bd767bffa4685c48f6a6d76be6054b93ffaea0e858f0d6a2ed29db1
7
+ data.tar.gz: 05fa884031b73de440c10442a46d2c328fb118d0e8c7447d241b6d5e2391408affddf964b7ae210038bc40f620009a38537cccbe418c9dc6ea562f7f50b76537
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.34] - 2024-03-26
4
+ ### Changed
5
+ - Removing the acquirer from the request queue during a lock obtaining logic now using more proper and accurate `ZREM` instead of `ZPOPMIN` for this;
6
+
3
7
  ## [0.0.33] - 2024-03-26
4
8
  ### Added
5
9
  - Logging: added current lock data info to the detailed `#try_to_lock` log to the cases when lock is still obtained. It is suitable
@@ -9,18 +13,18 @@
9
13
  ## [0.0.32] - 2024-03-26
10
14
  ### Added
11
15
  - Support for custom metadata that merged to the lock data. This data also returned from `RedisQueudLocks::Client#lock_info` method;
12
- - Custom metadata shou;d be represented as a `key => value` `Hash` data (or `NilClass` instead);
16
+ - Custom metadata should be represented as a `key => value` `Hash` (`nil` by default);
13
17
  - Custom metadata values is returned as raw data from Redis (commonly as strings);
14
18
  - Custom metadata can not contain reserved lock data keys;
15
19
  - Reduced some memory consuption;
16
20
  ### Changed
17
- - `RedisQueuedLocks::Client#lock_info` - has keys is changed from `Symbol` type to `String` type;
18
- - `RedisQueuedLocks::Client#queue_info` - hash keys is changed from `Symbol` type to `String` type;
21
+ - `RedisQueuedLocks::Client#lock_info`: hash key types of method result is changed from `Symbol` type to `String` type;
22
+ - `RedisQueuedLocks::Client#queue_info`: hash key types of method result is changed from `Symbol` type to `String` type;
19
23
 
20
24
  ## [0.0.31] - 2024-03-25
21
25
  ### Changed
22
26
  - `:metadata` renamed to `:instrument` in order to reflect it's domain area;
23
- - `:metadata` is renamed to `:meta` and reserved for the future updates;
27
+ - `:metadata` is renamed to `:meta` and reserved for future updates;
24
28
 
25
29
  ## [0.0.30] - 2024-03-23
26
30
  ### Fixed
data/README.md CHANGED
@@ -108,7 +108,7 @@ clinet = RedisQueuedLocks::Client.new(redis_client) do |config|
108
108
  config.default_lock_ttl = 5_000
109
109
 
110
110
  # (seconds) (default: 15)
111
- # - lock request timeout. after this timeout your lock request in queue will be requeued;
111
+ # - lock request timeout. after this timeout your lock request in queue will be requeued with new position (at the end of the queue);
112
112
  config.default_queue_ttl = 15
113
113
 
114
114
  # (default: 100)
@@ -161,7 +161,6 @@ clinet = RedisQueuedLocks::Client.new(redis_client) do |config|
161
161
  # - "[redis_queued_locks.try_lock.exit__no_first]" (logs "lock_key", "queue_ttl", "acq_id", "first_acq_id_in_queue", "<current_lock_data>");
162
162
  # - "[redis_queued_locks.try_lock.exit__still_obtained]" (logs "lock_key", "queue_ttl", "acq_id", "first_acq_id_in_queue", "locked_by_acq_id", "<current_lock_data>");
163
163
  # - "[redis_queued_locks.try_lock.run__free_to_acquire]" (logs "lock_key", "queue_ttl", "acq_id");
164
- # - if logger is not configured this option does not lead to any effect;
165
164
  config.log_lock_try = false
166
165
  end
167
166
  ```
@@ -330,8 +329,7 @@ See `#lock` method [documentation](#lock---obtain-a-lock).
330
329
  - `"ts"` - `integer`/`epoch` - the time lock was obtained;
331
330
  - `"init_ttl"` - `integer` - (milliseconds) initial lock key ttl;
332
331
  - `"rem_ttl"` - `integer` - (milliseconds) remaining lock key ttl;
333
- - custom metadata keys - `String` - custom metadata passed to the `lock`/`lock!`
334
- methods via `meta:` keyword argument (see [lock]((#lock---obtain-a-lock)) method documentation);
332
+ - `custom metadata`- `string`/`integer` - custom metadata passed to the `lock`/`lock!` methods via `meta:` keyword argument (see [lock]((#lock---obtain-a-lock)) method documentation);
335
333
 
336
334
  ```ruby
337
335
  # without custom metadata
@@ -640,16 +638,14 @@ Detalized event semantics and payload structure:
640
638
  - `100%` test coverage;
641
639
  - per-block-holding-the-lock sidecar `Ractor` and `in progress queue` in RedisDB that will extend
642
640
  the acquired lock for long-running blocks of code (that invoked "under" the lock
643
- whose ttl may expire before the block execution completes). It only makes sens for non-`timed` locks
644
- (for those locks where otaned with `timed: false` option);
645
- - an ability to add custom metadata to the lock and an ability to read this data;
641
+ whose ttl may expire before the block execution completes). It only makes sense for non-`timed` locks;
646
642
  - lock prioritization;
647
643
  - support for LIFO strategy;
648
- - structured logging;
644
+ - structured logging (separated docs);
649
645
  - GitHub Actions CI;
650
646
  - `RedisQueuedLocks::Acquier::Try.try_to_lock` - detailed successful result analization;
651
647
  - better code stylization and interesting refactorings;
652
- - dead queue cleanup;
648
+ - dead queue keys cleanup (empty queues);
653
649
  - statistics with UI;
654
650
  - support for `Dragonfly` DB backend;
655
651
  - support for `Garnet` DB backend;
@@ -64,7 +64,9 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
64
64
  end
65
65
  end
66
66
 
67
- # Step 0: watch the lock key changes (and discard acquirement if lock is already acquired)
67
+ # Step 0:
68
+ # watch the lock key changes (and discard acquirement if lock is already
69
+ # obtained by another acquier during the current lock acquiremntt)
68
70
  rconn.multi(watch: [lock_key]) do |transact|
69
71
  # Fast-Step X0: fail-fast check
70
72
  if fail_fast && rconn.call('HGET', lock_key, 'acq_id')
@@ -216,7 +218,7 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
216
218
  # NOTE: required lock is free and ready to be acquired! acquire!
217
219
 
218
220
  # Step 6.1: remove our acquier from waiting queue
219
- transact.call('ZPOPMIN', lock_key_queue, '1')
221
+ transact.call('ZREM', lock_key_queue, acquier_id)
220
222
 
221
223
  RedisQueuedLocks.debug(
222
224
  'Step №4: Забираем наш текущий процесс из очереди. [ZPOPMIN]'
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 0.0.33
9
- VERSION = '0.0.33'
8
+ # @version 0.0.34
9
+ VERSION = '0.0.34'
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_queued_locks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33
4
+ version: 0.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-25 00:00:00.000000000 Z
11
+ date: 2024-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client