def transaction_with_retry(txn_options = {}, retry_options = {})
      base_obj = self.respond_to?(:transaction) ? self : ActiveRecord::Base

      with_transaction_retry(retry_options) do
        base_obj.transaction(txn_options) do
          yield
        end
      end
    end
def transaction_with_retry(txn_options = {}, retry_options = {})
      base_obj = self.respond_to?(:transaction) ? self : ActiveRecord::Base

      with_transaction_retry(retry_options) do
        base_obj.transaction(txn_options) do
          yield
        end
      end
    end
Execute some code in a DB transaction, with retry