Skip to content

Commit

Permalink
Fix for cluster sends recursive MOVED error in very short time.
Browse files Browse the repository at this point in the history
  • Loading branch information
yajima-yusuke committed Nov 21, 2019
1 parent c7b69ba commit 1f59ca1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/redis/cluster.rb
Expand Up @@ -216,7 +216,10 @@ def try_send(node, method_name, *args, retry_count: 3, &block)
node.public_send(method_name, *args, &block)
rescue CommandError => err
if err.message.start_with?('MOVED')
assign_redirection_node(err.message).public_send(method_name, *args, &block)
raise if retry_count <= 0
node = assign_redirection_node(err.message)
retry_count -= 1
retry
elsif err.message.start_with?('ASK')
raise if retry_count <= 0
node = assign_asking_node(err.message)
Expand Down

0 comments on commit 1f59ca1

Please sign in to comment.