redstream 0.3.0 → 0.4.0

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: 7c563156ded6459fa0a2c4fcd317d3d5a128a72fe8f0732b358672efec718a3b
4
- data.tar.gz: 41c68a6d61e4287d5bffca7bd9277f55ef203d804b609b87de4b85cc7185560c
3
+ metadata.gz: 160386bd218415c11c556b1cdfc8824ed347e7279fac67f390c07b37c7128eff
4
+ data.tar.gz: '087e4ecaee15bd2f9db4367f53297a72f01c8de1cc093ae25ff3d4eb8ae29b90'
5
5
  SHA512:
6
- metadata.gz: 812e8cb419ea1a301e462250f20c798f92db02726b46e8eb196e169e8f6dcede85023cbecaa7b9b476d1e18e9b8902bfa68d36b49813dd4dea8f37b202fe9b5b
7
- data.tar.gz: e36a3fb9130992efd3cd812ac8b1368ab7dc056cc88016208ec83cc629077650aca935bb2d556396a47cc980f428515713de3bda61fd023867970d55e470755f
6
+ metadata.gz: d4d0945a2d2cb4b38dd398e5368963b5c8ba63aa93bc065bcb0c78a0e6bd7d2c0a7f825dd76b7b1d0ff79b6874bf1c3d0cb8f29843977d7676d341cfa584ed5d
7
+ data.tar.gz: b53bc33ce21244d64307b22f98185367e7c5806aeed9e50ed2b9dd123278b19236a049042bde26870dacd99702df49966674d1c629bf73ad955ff176f3f25a7b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.4.0
4
+ * Make delay message id params in queue methods optional
5
+
3
6
  ## v0.3.0
4
7
  * Pipeline deletion of delay messages
5
8
 
@@ -90,8 +90,9 @@ module Redstream
90
90
  # Writes messages to a stream in redis for immediate retrieval.
91
91
  #
92
92
  # @param records [#to_a] The object/objects that will be updated deleted
93
+ # @param delay_message_ids [#to_a] The delay message ids to delete
93
94
 
94
- def bulk_queue(records, delay_message_ids:)
95
+ def bulk_queue(records, delay_message_ids: nil)
95
96
  records.each_with_index.each_slice(250) do |slice|
96
97
  Redstream.connection_pool.with do |redis|
97
98
  redis.pipelined do
@@ -127,8 +128,9 @@ module Redstream
127
128
  # Writes a single message to a stream in redis for immediate retrieval.
128
129
  #
129
130
  # @param object The object hat will be updated, deleted, etc.
131
+ # @param delay_message_id The delay message id to delete
130
132
 
131
- def queue(object, delay_message_id:)
133
+ def queue(object, delay_message_id: nil)
132
134
  Redstream.connection_pool.with do |redis|
133
135
  redis.pipelined do
134
136
  redis.xadd(Redstream.stream_key_name(stream_name(object)), payload: JSON.dump(object.redstream_payload))
@@ -1,3 +1,3 @@
1
1
  module Redstream
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -7,7 +7,7 @@ RSpec.describe Redstream::Producer do
7
7
 
8
8
  stream_key_name = Redstream.stream_key_name("products")
9
9
 
10
- expect { Redstream::Producer.new.queue(product, delay_message_id: nil) }.to change { redis.xlen(stream_key_name) }.by(1)
10
+ expect { Redstream::Producer.new.queue(product) }.to change { redis.xlen(stream_key_name) }.by(1)
11
11
  expect(redis.xrange(stream_key_name, "-", "+").last[1]).to eq("payload" => JSON.dump(product.redstream_payload))
12
12
  end
13
13
 
@@ -99,7 +99,7 @@ RSpec.describe Redstream::Producer do
99
99
 
100
100
  stream_key_name = Redstream.stream_key_name("products")
101
101
 
102
- expect { Redstream::Producer.new.bulk_queue(Product.all, delay_message_ids: nil) }.to change { redis.xlen(stream_key_name) }.by(2)
102
+ expect { Redstream::Producer.new.bulk_queue(Product.all) }.to change { redis.xlen(stream_key_name) }.by(2)
103
103
 
104
104
  messages = redis.xrange(stream_key_name, "-", "+").last(2).map { |message| message[1] }
105
105
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter