Skip to content

Commit

Permalink
Legacy reads should also check #write_retryable? on retry
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmo committed Jun 13, 2024
1 parent 860b4ff commit 4bb1d09
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/mongo/retryable/read_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ def legacy_read_with_retry(session, server_selector, &block)

if is_retryable_exception?(e)
raise e if attempt > client.max_read_retries || session&.in_transaction?
elsif e.retryable? && !session&.in_transaction?
# some new retryable errors only include WriteRetryable
elsif e.respond_to?(:write_retryable?) && !e.write_retryable? && !session&.in_transaction?
raise e if attempt > client.max_read_retries
elsif e.respond_to?(:retryable?) && e.retryable? && !session&.in_transaction?
raise e if attempt > client.max_read_retries
else
raise e
Expand Down

0 comments on commit 4bb1d09

Please sign in to comment.