redis_batch 0.0.3 → 0.0.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +40 -0
  4. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21c8d0fc6fa834d58afff202ad63597688d3ec0943cba4f06d82e0033201b820
4
- data.tar.gz: fe2a7c88467d02c85e205d726b53c6aff4f191d0c08aa7d88831c0414bdbcd6a
3
+ metadata.gz: 64bdfe75e083eae21c7aa0b366a44850903cb0911546644a0ade2f071d753a02
4
+ data.tar.gz: 30ea83d6a94380af5c01df6768869cd8c25dbb472d150549fda31279e74684f1
5
5
  SHA512:
6
- metadata.gz: db65fe573cc1e50e53e870f620944dedb9d941309019ba06e068b2b49d8c9c6ff7b04b3352f560afeb2d487626fddd27cc26455c678685a021d29ee68d99198a
7
- data.tar.gz: 1bbcf4b38252e74cd8e59ff705ee21c79ad9833f80933ca6b05f366da44a99225c0198e368bc691ee9022f85a56df2c847a61f5845a3a2a52cc60ca04a602f33
6
+ metadata.gz: 93edb30262b55d8d1ba17e2a551cecbf8e8236c33cac3f60eb7288dfd831c3614e0565a6d448f0b25171b862021033779612e9595e55ea2e692ae6760bfa5ec8
7
+ data.tar.gz: 4c143ce57f44c0ae0638b4901672c06fe37278a18b7ce1b7f846a507bf71bd0b748c71f2a65b0891cd84602e7a8ca4e045aaa5e09e75b56e5545c80af547678f
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Christian Avemark
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ ## Redis Batch
2
+
3
+ ![tests](https://github.com/avemark/redis_batch_rb/actions/workflows/tests.yaml/badge.svg)
4
+
5
+ A redis queue with reliable multi-element dequeue, intended for work aggregation.
6
+ Requires redis version >= 7
7
+
8
+ Common background work libraries like Resque, Sidekiq and GoodJob assume no coherence in
9
+ the elements of their work queues, and will act on elements one by one.
10
+
11
+ Sometimes you want to asynchronously aggregate work units and later deal with them in batches, and this gem intends
12
+ to facilitate that kind of pattern.
13
+
14
+ This gem does not try to deal with scheduling of dequeueing nor does it assist (much) with error handling.
15
+
16
+ If an error is raised within the `take` block, the taken values are returned to the queue.
17
+
18
+ If your process is killed for external reasons, the taken items might get stuck in the processing queue. `myqueue.abort_all` will clear all processing queues.
19
+ If you take out elements concurrently, there is currently no way to distinguish such stuck processing queues from healthy queues. A timestamping feature to alleviate this might be added in the future.
20
+ ### Usage
21
+ ```Shell
22
+ gem install redis_batch
23
+ ```
24
+ ```Ruby
25
+ MessageQueue = Class.new(RedisBatch::Queue)
26
+ my_queue = MessageQueue.new
27
+
28
+ my_queue.add "Hello", "world"
29
+ my_queue.count => 2
30
+
31
+ the_same_queue = RedisBatch::Queue.new("MessageQueue")
32
+ the_same_queue.count => 2
33
+
34
+ my_queue.take(10) { |messages| messages.join(", ") } => "Hello, world"
35
+ my_queue.count => 0
36
+
37
+ my_queue.add "uh", "oh"
38
+ my_queue.take(10) { |messages| raise(messages.join("-")) } => StandardError: "uh-oh"
39
+ my_queue.count => 2
40
+ ```
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Avemark
@@ -31,6 +31,8 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - LICENSE
35
+ - README.md
34
36
  - lib/redis_batch.rb
35
37
  - lib/redis_batch/client.rb
36
38
  - lib/redis_batch/configurable.rb