]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/plugins/deadlock_retry/lib/deadlock_retry.rb
Update deadlock_retry plugin with latest upstream code.
[rails.git] / vendor / plugins / deadlock_retry / lib / deadlock_retry.rb
index 413cb823c43ffd1e6c1c5deea73b1111447b15e1..39aeff869760e1963ff550c2f4e17bca5500cf9a 100644 (file)
@@ -44,6 +44,7 @@ module DeadlockRetry
       begin
         transaction_without_deadlock_handling(*objects, &block)
       rescue ActiveRecord::StatementInvalid => error
+        raise unless connection.open_transactions.zero?
         if DEADLOCK_ERROR_MESSAGES.any? { |msg| error.message =~ /#{Regexp.escape(msg)}/ }
           raise if retry_count >= MAXIMUM_RETRIES_ON_DEADLOCK
           retry_count += 1