redis-cluster-client 0.4.4 → 0.4.6

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: 75b13bfebd7ddbbb49d37626af8bae2b0a0c21ddc7ad198856c60c502700909e
4
+ data.tar.gz: 9f8deb6e34399711ba7e432a85747272c51aa5525e3efc8d637577baab831e9e
5
5
  SHA512:
6
- metadata.gz: 92a61bcbb6964cb41ed791768d346f65b48d1943627fbea13b86cf995e921990dcc41651553f7c5200e60cebc7c5cc7e519795e02a9173e37dd1ef4da1201006
7
- data.tar.gz: a27605d3438d40da8be910776db98fd6ede734c9ac8824c3bcedfc599d0d1f3f6f00187a7e785f96d0da8d1f480b0c6f012fa4670e31edf1c152f189a59bcf73
6
+ metadata.gz: 764b1ff360c46af8afebe9d937a2ac2ba3442701a4b5e9626af6157557bb29f9e35f0d0dcaff473cc77aa47b9930c6e179e42ceffa501d2105ab478e2d4f6fc8
7
+ data.tar.gz: 2eec106a7a6d0e38253ffca1f115d2a5368f3dd3c5bcfaafe25bb51bba35be67ba765dd5f6d93916d3eb23193bf4e588fe33833df8602475b58867ef8801585f
@@ -9,6 +9,7 @@ class RedisClient
9
9
  @router = router
10
10
  @command_builder = command_builder
11
11
  @pubsub_states = {}
12
+ @messages = []
12
13
  end
13
14
 
14
15
  def call(*args, **kwargs)
@@ -22,13 +23,15 @@ class RedisClient
22
23
  def close
23
24
  @pubsub_states.each_value(&:close)
24
25
  @pubsub_states.clear
26
+ @messages.clear
25
27
  end
26
28
 
27
29
  def next_event(timeout = nil)
28
- msgs = collect_messages(timeout).compact
29
- return msgs.first if msgs.size == 1
30
+ return if @pubsub_states.empty?
31
+ return @messages.shift unless @messages.empty?
30
32
 
31
- msgs
33
+ collect_messages(timeout)
34
+ @messages.shift
32
35
  end
33
36
 
34
37
  private
@@ -44,7 +47,7 @@ class RedisClient
44
47
  end
45
48
 
46
49
  def collect_messages(timeout)
47
- @pubsub_states.each_slice(MAX_THREADS).each_with_object([]) do |chuncked_pubsub_states, acc|
50
+ @pubsub_states.each_slice(MAX_THREADS) do |chuncked_pubsub_states|
48
51
  threads = chuncked_pubsub_states.map do |_, v|
49
52
  Thread.new(v) do |pubsub|
50
53
  Thread.current[:reply] = pubsub.next_event(timeout)
@@ -55,7 +58,7 @@ class RedisClient
55
58
 
56
59
  threads.each do |t|
57
60
  t.join
58
- acc << t[:reply]
61
+ @messages << t[:reply] unless t[:reply].nil?
59
62
  end
60
63
  end
61
64
  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.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga