Skip to content

Commit d56b359

Browse files
authored
perf: reduce too much shuffle which was intended to prevent biased subscription (#247)
1 parent be32f1f commit d56b359

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/redis_client/cluster/pub_sub.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ def close
6464
def next_event(timeout = nil)
6565
return if @state_list.empty?
6666

67+
@state_list.shuffle!
6768
max_duration = calc_max_duration(timeout)
6869
starting = obtain_current_time
6970
loop do
7071
break if max_duration > 0 && obtain_current_time - starting > max_duration
7172

72-
@state_list.shuffle!
7373
@state_list.each do |pubsub|
7474
message = pubsub.take_message(timeout)
7575
return message if message

0 commit comments

Comments
 (0)