redstream 0.4.3 → 0.4.4

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: 032fbb3b9ee72cf051d9b9dffe996d1efee73b106952d7739bfe75a08190ac2c
4
- data.tar.gz: da3131c6117fb981d1709d5825b94bc09f59cd771835cfd0516cfec22765d09a
3
+ metadata.gz: e25cd9c9c13d7fe93e81207a7608599e37c72a39425b54108c7178b3e97917f3
4
+ data.tar.gz: 5a5179bf6de8ef24effa908595a32bbcccd9c5c717988ce25a0f38aa128b6cab
5
5
  SHA512:
6
- metadata.gz: 55bf7e981765709911f69af1c30a8ee00dc1138bc0b6636ef6ec3442c5428138eebfb23553069cae3be520e1d8b5c40594db9c3c6646d18555834761813e4551
7
- data.tar.gz: 4dda09649b7f523f57a19dc8e17a8c3c9a9177199c26b8530db45fa634d1bc0e589ddc44eeddb4fc8f67a81a3e03d81f09ac6d432b1bb60d39e943bb27a22f9e
6
+ metadata.gz: adee0c463fb89d9f112b3bc374c25fcb7fe60819f18952133df3afe789bcbabca5fcc184d144b5dff8db747098b2c8953cb440be474d6dd1df4ed004fd1e6467
7
+ data.tar.gz: 430b4df8d3095e9375320f9fbfa83aa24615bf2d6b19c2deba663fb69db3806a664dddd83c3f98f5f26b28c8de603f69d8ed926943043be905771d16595dc10e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.4.4
4
+ * Remove deletion of delay messages after queues messages are sent from `.bulk`
5
+
3
6
  ## v0.4.3
4
7
  * Change gemspec to support older redis versions again
5
8
 
@@ -52,11 +52,11 @@ module Redstream
52
52
  def bulk(records)
53
53
  records_array = Array(records)
54
54
 
55
- delay_message_ids = bulk_delay(records_array)
55
+ bulk_delay(records_array)
56
56
 
57
57
  yield
58
58
 
59
- bulk_queue(records_array, delay_message_ids: delay_message_ids)
59
+ bulk_queue(records_array)
60
60
  end
61
61
 
62
62
  # @api private
@@ -68,7 +68,7 @@ module Redstream
68
68
  # @return The redis message ids
69
69
 
70
70
  def bulk_delay(records)
71
- res = records.each_slice(250).flat_map do |slice|
71
+ records.each_slice(250) do |slice|
72
72
  Redstream.connection_pool.with do |redis|
73
73
  redis.pipelined do |pipeline|
74
74
  slice.each do |object|
@@ -82,7 +82,7 @@ module Redstream
82
82
  redis.wait(@wait, 0) if @wait
83
83
  end
84
84
 
85
- res
85
+ true
86
86
  end
87
87
 
88
88
  # @api private
@@ -90,15 +90,13 @@ 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
94
93
 
95
- def bulk_queue(records, delay_message_ids: nil)
96
- records.each_with_index.each_slice(250) do |slice|
94
+ def bulk_queue(records)
95
+ records.each_slice(250) do |slice|
97
96
  Redstream.connection_pool.with do |redis|
98
97
  redis.pipelined do |pipeline|
99
- slice.each do |object, index|
98
+ slice.each do |object|
100
99
  pipeline.xadd(Redstream.stream_key_name(stream_name(object)), { payload: JSON.dump(object.redstream_payload) })
101
- pipeline.xdel(Redstream.stream_key_name("#{stream_name(object)}.delay"), delay_message_ids[index]) if delay_message_ids
102
100
  end
103
101
  end
104
102
  end
@@ -1,3 +1,3 @@
1
1
  module Redstream
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
data/redstream.gemspec CHANGED
@@ -14,7 +14,6 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
17
  spec.require_paths = ["lib"]
19
18
 
20
19
  spec.add_development_dependency "activerecord"
@@ -78,19 +78,6 @@ RSpec.describe Redstream::Producer do
78
78
  { "payload" => JSON.dump(products[1].redstream_payload) }
79
79
  ])
80
80
  end
81
-
82
- it "deletes the delay messages after the queue messages have been sent" do
83
- products = create_list(:product, 2)
84
- producer = Redstream::Producer.new
85
-
86
- other_delay_message_id = producer.delay(create(:product))
87
-
88
- producer.bulk(products) do
89
- expect(redis.xlen(Redstream.stream_key_name("products.delay"))).to eq(3)
90
- end
91
-
92
- expect(redis.xrange(Redstream.stream_key_name("products.delay"), "-", "+").map(&:first)).to eq([other_delay_message_id])
93
- end
94
81
  end
95
82
 
96
83
  describe "#bulk_queue" do
@@ -108,18 +95,6 @@ RSpec.describe Redstream::Producer do
108
95
  { "payload" => JSON.dump(products[1].redstream_payload) }
109
96
  ])
110
97
  end
111
-
112
- it "deletes the delay messages after the queue messages have been sent" do
113
- products = create_list(:product, 2)
114
- producer = Redstream::Producer.new
115
-
116
- delay_message_ids = producer.bulk_delay(products)
117
- other_delay_message_id = producer.delay(create(:product))
118
-
119
- producer.bulk_queue(products, delay_message_ids: delay_message_ids)
120
-
121
- expect(redis.xrange(Redstream.stream_key_name("products.delay"), "-", "+").map(&:first)).to eq([other_delay_message_id])
122
- end
123
98
  end
124
99
 
125
100
  describe "#bulk_delay" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-28 00:00:00.000000000 Z
11
+ date: 2022-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -294,12 +294,4 @@ signing_key:
294
294
  specification_version: 4
295
295
  summary: Using redis streams to keep your primary database in sync with secondary
296
296
  datastores
297
- test_files:
298
- - spec/redstream/consumer_spec.rb
299
- - spec/redstream/delayer_spec.rb
300
- - spec/redstream/lock_spec.rb
301
- - spec/redstream/model_spec.rb
302
- - spec/redstream/producer_spec.rb
303
- - spec/redstream/trimmer_spec.rb
304
- - spec/redstream_spec.rb
305
- - spec/spec_helper.rb
297
+ test_files: []