redis-cluster-client 0.17.0 → 0.17.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7df1ba6006c9d3c3e7c242e9406f6443a95aa371c7e77244b73565058f476435
4
- data.tar.gz: 5613bf92dc543482c1bcb2e74d61096092c299ef84877b8c06da1174db82c6d4
3
+ metadata.gz: 5dbfbaf304e900620662da7b8b5e6af36dfda8dc62a27d3e9a1efb975f5bd07f
4
+ data.tar.gz: 8080422513db9f7edcbad4d3eafc4fb0472d5a754ee2a0bc64eaacfda8e283e0
5
5
  SHA512:
6
- metadata.gz: 58e9ecaa1aecf6bfb298cba78e08d349f742439a2f5a53e19cd55bb49c8a600b4e4f47a54af1798ef0afe51cb56cf5cf292eda3bdf75e522ed180fa065e37954
7
- data.tar.gz: c158336f83f4453e27798a2521c4e282a867db446dfa7e74e988af9e568567235b321b59386bf79ac5d0e32dee0698137755e9c416ceeb3acb150ebfc60d5208
6
+ metadata.gz: 980a40227b929c64632ff903ad4334942489d3c2af13ef0ec09006be856ae7c06a2e96c1a4c8c9a976b38091f53aa2e87833a5d6d04c07a0426129da20924838
7
+ data.tar.gz: b7915e5337c66a3a0423ebcb206e7be0b3794ce1ccac40a1a99e08b8f305a594c9594d6a670f3679d1df081e80527fde4a153ac6949c7ca832bbb149fc0dcfee
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'set'
3
4
  require 'redis_client'
4
5
  require 'redis_client/cluster/errors'
5
6
  require 'redis_client/cluster/noop_command_builder'
@@ -44,6 +45,19 @@ class RedisClient
44
45
  def get_block(inner_index)
45
46
  @blocks.is_a?(Array) ? @blocks[inner_index] : nil
46
47
  end
48
+
49
+ def coerce_except!(replies, indices)
50
+ return replies unless @blocks.is_a?(Array)
51
+
52
+ skipped = Set.new(indices)
53
+ @blocks.each_with_index do |block, index|
54
+ next if block.nil? || skipped.include?(index)
55
+
56
+ replies[index] = block.call(replies[index])
57
+ end
58
+
59
+ replies
60
+ end
47
61
  end
48
62
 
49
63
  ::RedisClient::ConnectionMixin.module_eval do
@@ -209,6 +223,7 @@ class RedisClient
209
223
 
210
224
  all_replies ||= Array.new(@size)
211
225
  pipeline = @pipelines[node_key]
226
+ pipeline.coerce_except!(v.replies, v.indices)
212
227
  v.indices.each { |i| v.replies[i] = handle_redirection(v.replies[i], pipeline, i) }
213
228
  pipeline.outer_indices.each_with_index { |outer, inner| all_replies[outer] = v.replies[inner] }
214
229
  end
@@ -217,7 +232,9 @@ class RedisClient
217
232
  raise v.first_exception if v.first_exception
218
233
 
219
234
  all_replies ||= Array.new(@size)
220
- @pipelines[node_key].outer_indices.each_with_index { |outer, inner| all_replies[outer] = v.replies[inner] }
235
+ pipeline = @pipelines[node_key]
236
+ pipeline._coerce!(v.replies)
237
+ pipeline.outer_indices.each_with_index { |outer, inner| all_replies[outer] = v.replies[inner] }
221
238
  end
222
239
 
223
240
  all_replies
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-cluster-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga