Skip to content

Commit

Permalink
Merge pull request #882 from haruwo/retry-once-to-many-on-moved-error…
Browse files Browse the repository at this point in the history
…-by-cluster

Retry once to many on `MOVED` error at cluster
  • Loading branch information
byroot committed Nov 24, 2019
2 parents c7b69ba + 1f59ca1 commit bd6ee65
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 bd6ee65

Please sign in to comment.