redis_queued_locks 0.0.36 → 0.0.38
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 -0
- data/README.md +13 -13
- data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock.rb +2 -1
- data/lib/redis_queued_locks/acquier/locks.rb +0 -6
- data/lib/redis_queued_locks/acquier/queues.rb +1 -1
- data/lib/redis_queued_locks/client.rb +1 -1
- data/lib/redis_queued_locks/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 863e2fffb431d3db21fa7aa88b6238d072475c863f4927e7277d2fb052cb7af1
|
4
|
+
data.tar.gz: c5a67c1f2f44cbc1269d5f01600738ab193fefcdab1f5d072ead8fd2d7260b13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88cea7bce9a2522eea4a8af5a3c749874508595ec1d7f6df3af20fc8b15b2e7238a1dbaa8ccbee2414c42ac1a2eccc8daf5fb5a73aabd21c0517b97f3472f43b
|
7
|
+
data.tar.gz: 86a4a86b8928b0cccc0b4db94a38ee86e52a0cc5929a55db96e38fcfa9c8ac596e05df0ea7709465d561b2322165d333a996f7bd3f5ebff3bb32b43bfd5c7f4f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.0.38] - 2024-03-28
|
4
|
+
### Changed
|
5
|
+
- Minor update (dropped useless constant);
|
6
|
+
|
7
|
+
## [0.0.37] - 2024-03-28
|
8
|
+
### Changed
|
9
|
+
- `#queues_info`: `:contains` is renamed to `:reqeusts` in order to reflect it's domain area;
|
10
|
+
|
3
11
|
## [0.0.36] - 2024-03-28
|
4
12
|
### Added
|
5
13
|
- Requirements:
|
data/README.md
CHANGED
@@ -595,7 +595,9 @@ rql.keys # or rql.keys(scan_size: 123)
|
|
595
595
|
- returns `Set<Hash<Symbol,Any>>` (see [#lock_info](#lock_info) and examples below for details).
|
596
596
|
- contained data: `{ lock: String, status: Symbol, info: Hash<String,Any> }`;
|
597
597
|
- `:lock` - `String` - lock key in Redis;
|
598
|
-
- `:status` - `Symbol`- `:released` or `:alive
|
598
|
+
- `:status` - `Symbol`- `:released` or `:alive`
|
599
|
+
- the lock may become relased durign the lock info extraction process;
|
600
|
+
- `:info` for `:released` keys is empty (`{}`);
|
599
601
|
- `:info` - `Hash<String,Any>` - lock data stored in the lock key in Redis. See [#lock_info](#lock_info) for details;
|
600
602
|
|
601
603
|
```ruby
|
@@ -612,11 +614,8 @@ rql.locks_info # or rql.locks_info(scan_size: 123)
|
|
612
614
|
"rem_ttl"=>13998}},
|
613
615
|
{:lock=>"rql:lock:some-lock-456",
|
614
616
|
:status=>:released,
|
615
|
-
:info=>{
|
616
|
-
|
617
|
-
"ts"=>1711607112.67106,
|
618
|
-
"ini_ttl"=>15000,
|
619
|
-
"rem_ttl"=>13999}}}>
|
617
|
+
:info=>{},
|
618
|
+
...}>
|
620
619
|
```
|
621
620
|
|
622
621
|
---
|
@@ -626,24 +625,25 @@ rql.locks_info # or rql.locks_info(scan_size: 123)
|
|
626
625
|
- uses redis `SCAN` under the hod;
|
627
626
|
- accepts `scan_size:`/`Integer` option (`config[:key_extraction_batch_size]` by default);
|
628
627
|
- returns `Set<Hash<Symbol,Any>>` (see [#queue_info](#queue_info) and examples below for details).
|
629
|
-
- contained data: `{ queue: String,
|
628
|
+
- contained data: `{ queue: String, requests: Array<Hash<String,Any>> }`
|
630
629
|
- `:queue` - `String` - lock key queue in Redis;
|
631
|
-
- `:
|
630
|
+
- `:requests` - `Array<Hash<String,Any>>` - lock requests in the que with their acquier id and score.
|
632
631
|
|
633
632
|
```ruby
|
634
633
|
rql.queues_info # or rql.qeuues_info(scan_size: 123)
|
635
634
|
|
636
635
|
=> #<Set:
|
637
636
|
{{:queue=>"rql:lock_queue:some-lock-123",
|
638
|
-
:
|
637
|
+
:requests=>
|
639
638
|
[{"acq_id"=>"rql:acq:38529/4500/4520/4360/66093702f24a3129", "score"=>1711606640.540842},
|
640
639
|
{"acq_id"=>"rql:acq:38529/4580/4600/4360/66093702f24a3129", "score"=>1711606640.540906},
|
641
640
|
{"acq_id"=>"rql:acq:38529/4620/4640/4360/66093702f24a3129", "score"=>1711606640.5409632}]},
|
642
641
|
{:queue=>"rql:lock_queue:some-lock-456",
|
643
|
-
:
|
642
|
+
:requests=>
|
644
643
|
[{"acq_id"=>"rql:acq:38529/4380/4400/4360/66093702f24a3129", "score"=>1711606640.540722},
|
645
644
|
{"acq_id"=>"rql:acq:38529/4420/4440/4360/66093702f24a3129", "score"=>1711606640.5407748},
|
646
|
-
{"acq_id"=>"rql:acq:38529/4460/4480/4360/66093702f24a3129", "score"=>1711606640.540808}]}
|
645
|
+
{"acq_id"=>"rql:acq:38529/4460/4480/4360/66093702f24a3129", "score"=>1711606640.540808}]},
|
646
|
+
...}>
|
647
647
|
```
|
648
648
|
|
649
649
|
---
|
@@ -686,7 +686,7 @@ Detalized event semantics and payload structure:
|
|
686
686
|
- `:lock_key` - `string` - lock name;
|
687
687
|
- `:ts` - `integer`/`epoch` - the time when the lock was obtaiend;
|
688
688
|
- `:acq_time` - `float`/`milliseconds` - time spent on lock acquiring;
|
689
|
-
- `:
|
689
|
+
- `:instrument` - `nil`/`Any` - custom data passed to the `lock`/`lock!` method as `:instrument` attribute;
|
690
690
|
- `"redis_queued_locks.lock_hold_and_release"`
|
691
691
|
- an event signalizes about the "hold+and+release" process
|
692
692
|
when the lock obtained and hold by the block of logic;
|
@@ -697,7 +697,7 @@ Detalized event semantics and payload structure:
|
|
697
697
|
- `:lock_key` - `string` - lock name;
|
698
698
|
- `:ts` - `integer`/`epoch` - the time when lock was obtained;
|
699
699
|
- `:acq_time` - `float`/`milliseconds` - time spent on lock acquiring;
|
700
|
-
- `:
|
700
|
+
- `:instrument` - `nil`/`Any` - custom data passed to the `lock`/`lock!` method as `:instrument` attribute;
|
701
701
|
- `"redis_queued_locks.explicit_lock_release"`
|
702
702
|
- an event signalizes about the explicit lock release (invoked via `RedisQueuedLock#unlock`);
|
703
703
|
- payload:
|
@@ -279,7 +279,8 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
|
|
279
279
|
# => (*) at this moment we accept that all comamnds are completed successfully;
|
280
280
|
# => (!) need to analyze:
|
281
281
|
# 1. zrem shoud return ? (?)
|
282
|
-
# 2. hset should return 3 as minimum
|
282
|
+
# 2. hset should return 3 as minimum
|
283
|
+
# (lock key is added to the redis as a hashmap with 3 fields as minimum)
|
283
284
|
# 3. pexpire should return 1 (expiration time is successfully applied)
|
284
285
|
|
285
286
|
# Step 7.d: locked! :) let's go! => successfully acquired
|
@@ -322,7 +322,7 @@ class RedisQueuedLocks::Client
|
|
322
322
|
# Possible options:
|
323
323
|
# - `true` => returns a set of hashes that represents the queue state: <queue:, containing:>
|
324
324
|
# - :queue (String) - the lock queue key in Redis database;
|
325
|
-
# - :
|
325
|
+
# - :requests (Array<Hash<String,Any>>) - queue state in redis. see #queue_info for details;
|
326
326
|
# - `false` => returns a set of strings that represents an active queues
|
327
327
|
# at the moment of Redis'es SCAN;
|
328
328
|
# @return [Set<String>,String<Hash<Symbol,Any>>]
|