Skip to content

Commit 9253d40

Browse files
authored
Merge pull request rails#46468 from nvasilevski/adjust-current-transaction-check
Check for transaction before invalidating the state
2 parents 7acbe5a + e4b4c50 commit 9253d40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activerecord/lib/active_record/connection_adapters/abstract_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ def invalidate_transaction(exception)
10121012
return unless exception.is_a?(TransactionRollbackError)
10131013
return unless savepoint_errors_invalidate_transactions?
10141014

1015-
current_transaction.state.invalidate! if current_transaction
1015+
current_transaction.state.invalidate! if current_transaction.open?
10161016
end
10171017

10181018
def retryable_query_error?(exception)

0 commit comments

Comments
 (0)