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 +4 -4
- data/lib/redis_client/cluster/pub_sub.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be67f7c4a1a9e75573c957233bc9381745fc143b483583a4abb02b6b794bf49a
|
4
|
+
data.tar.gz: b12b518ba293af7e8f84e9a8c4770c5d5e8d776e213af30db94bcba753612802
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|