redis-cluster-client 0.4.4 → 0.4.5

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: 16cd5b517f21a96b53fcaa47eb44e28b0c8d12aef23e3d2d239b2568d5ba61cd
4
- data.tar.gz: ec4a1ebf3e548fdd7bfb184a910511f98919eecda1987674bef8d135bfc8b9da
3
+ metadata.gz: be67f7c4a1a9e75573c957233bc9381745fc143b483583a4abb02b6b794bf49a
4
+ data.tar.gz: b12b518ba293af7e8f84e9a8c4770c5d5e8d776e213af30db94bcba753612802
5
5
  SHA512:
6
- metadata.gz: 92a61bcbb6964cb41ed791768d346f65b48d1943627fbea13b86cf995e921990dcc41651553f7c5200e60cebc7c5cc7e519795e02a9173e37dd1ef4da1201006
7
- data.tar.gz: a27605d3438d40da8be910776db98fd6ede734c9ac8824c3bcedfc599d0d1f3f6f00187a7e785f96d0da8d1f480b0c6f012fa4670e31edf1c152f189a59bcf73
6
+ metadata.gz: fa19e009a6af98f69b797a88fd0ce3e09c9cd74d0bed99fdcabf4c15e78435179736e66d5d18e0e2c66c44d6343ab75e443b3d8577b37beb91ed13065f00bf4c
7
+ data.tar.gz: e055226106abe328b92d84da1f63e2d3e3ef22168cf3716837e96a7491249862894d98fa49edd92681083d6617787701411e51dab391322f1259af86a730149f
@@ -25,8 +25,10 @@ class RedisClient
25
25
  end
26
26
 
27
27
  def next_event(timeout = nil)
28
+ return if @pubsub_states.empty?
29
+
28
30
  msgs = collect_messages(timeout).compact
29
- return msgs.first if msgs.size == 1
31
+ return msgs.first if msgs.size < 2
30
32
 
31
33
  msgs
32
34
  end
@@ -43,7 +45,7 @@ class RedisClient
43
45
  pubsub.call_v(command)
44
46
  end
45
47
 
46
- def collect_messages(timeout)
48
+ def collect_messages(timeout) # rubocop:disable Metrics/AbcSize
47
49
  @pubsub_states.each_slice(MAX_THREADS).each_with_object([]) do |chuncked_pubsub_states, acc|
48
50
  threads = chuncked_pubsub_states.map do |_, v|
49
51
  Thread.new(v) do |pubsub|
@@ -55,7 +57,7 @@ class RedisClient
55
57
 
56
58
  threads.each do |t|
57
59
  t.join
58
- acc << t[:reply]
60
+ acc << t[:reply] unless t[:reply].nil?
59
61
  end
60
62
  end
61
63
  end
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.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga