Raise transaction isolation level on epp domain update

This commit is contained in:
Alex Sherman 2020-06-25 11:59:45 +05:00
parent 2fdc487511
commit 821ea1a8b2

View file

@ -103,13 +103,19 @@ module Epp
def update def update
authorize! :update, @domain, @password 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 (handle_errors(@domain) && return) unless updated
pending = @domain.epp_pending_update.present? pending = @domain.epp_pending_update.present?
render_epp_response "/epp/domains/success#{'_pending' if pending}" render_epp_response "/epp/domains/success#{'_pending' if pending}"
end end
def isolation_level
:serializable unless Rails.env.test?
end
def delete def delete
authorize! :delete, @domain, @password authorize! :delete, @domain, @password