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 +4 -4
- data/CHANGELOG.md +8 -4
- data/README.md +5 -9
- data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock.rb +4 -2
- data/lib/redis_queued_locks/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62b1870f7a71fb878167216b1f05a90f82c60b8a0da513dfad1edae8a87618a5
|
4
|
+
data.tar.gz: 705c1e47d0f4823e38f749f24e82700ce33d749e187c0ae98ff9bd5ff21aa142
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
18
|
-
- `RedisQueuedLocks::Client#queue_info
|
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
|
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
|
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
|
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:
|
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('
|
221
|
+
transact.call('ZREM', lock_key_queue, acquier_id)
|
220
222
|
|
221
223
|
RedisQueuedLocks.debug(
|
222
224
|
'Step №4: Забираем наш текущий процесс из очереди. [ZPOPMIN]'
|
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.
|
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-
|
11
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|