File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -548,8 +548,10 @@ def self.all_open_transactions # :nodoc:
548
548
open_transactions = [ ]
549
549
Base . connection_handler . each_connection_pool do |pool |
550
550
if active_connection = pool . active_connection
551
- if active_connection . current_transaction . open? && active_connection . current_transaction . joinable?
552
- open_transactions << active_connection . current_transaction
551
+ current_transaction = active_connection . current_transaction
552
+
553
+ if current_transaction . open? && current_transaction . joinable? && !current_transaction . state . invalidated?
554
+ open_transactions << current_transaction
553
555
end
554
556
end
555
557
end
Original file line number Diff line number Diff line change @@ -67,6 +67,14 @@ def test_after_all_transactions_commit
67
67
raise ActiveRecord ::Rollback
68
68
end
69
69
assert_equal 0 , called
70
+
71
+ called = 0
72
+ Topic . transaction do |transaction |
73
+ transaction . instance_variable_get ( :@internal_transaction ) . invalidate!
74
+ ActiveRecord . after_all_transactions_commit { called += 1 }
75
+ assert_equal 1 , called
76
+ end
77
+ assert_equal 1 , called
70
78
end
71
79
72
80
def test_after_current_transaction_commit_multidb_nested_transactions
You can’t perform that action at this time.
0 commit comments