Skip to content

Commit

Permalink
See OPS-177 : Minor fix to the retry logic
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnun committed Nov 15, 2021
1 parent d43a219 commit 992ef92
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/makara/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,15 @@ def any_connection
def _execute_with_connection_and_retry_exceptions(retry_exceptions, args, block, method_name)
begin
should_retry = false
potentially_stale_connection = nil

appropriate_connection(method_name, args) do |con|
con.send(method_name, *args, &block)
potentially_stale_connection = con
end

rescue Exception => actual_exception
retry_attempts = retry_exceptions.inject({}) { |memo, retry_exception| memo[retry_exception['name']] = 0; memo }
retry_exceptions.each do |retry_exception|
if actual_exception.class.to_s == retry_exception['name']
potentially_stale_connection.disconnect!
sleep retry_exception['time_between_retries_in_seconds'] || 0.1
retry_attempt = (retry_attempts[actual_exception.class.to_s] += 1)

Expand Down

0 comments on commit 992ef92

Please sign in to comment.