From 821ea1a8b2bc3c9ccb8170dbffe61db01138a6ae Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 25 Jun 2020 11:59:45 +0500 Subject: [PATCH] Raise transaction isolation level on epp domain update --- app/controllers/epp/domains_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index fa0003756..46012a738 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -103,13 +103,19 @@ module Epp def update authorize! :update, @domain, @password - updated = @domain.update(params[:parsed_frame], current_user) + updated = Domain.transaction(isolation: isolation_level) do + @domain.update(params[:parsed_frame], current_user) + end (handle_errors(@domain) && return) unless updated pending = @domain.epp_pending_update.present? render_epp_response "/epp/domains/success#{'_pending' if pending}" end + def isolation_level + :serializable unless Rails.env.test? + end + def delete authorize! :delete, @domain, @password