From 3c4f46a8867f84c3d5836a8794cfbf34c5f87c0b Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 12 Jan 2021 15:03:51 +0100 Subject: [PATCH] Maintenance: `ApplicationHandleInfo.current = 'application_server'` leaks into following test on raised exceptions while processing Controller action. --- .../application_controller/handles_transitions.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller/handles_transitions.rb b/app/controllers/application_controller/handles_transitions.rb index d708af9ba..f81d35fb2 100644 --- a/app/controllers/application_controller/handles_transitions.rb +++ b/app/controllers/application_controller/handles_transitions.rb @@ -2,20 +2,21 @@ module ApplicationController::HandlesTransitions extend ActiveSupport::Concern included do - before_action :transaction_begin - after_action :transaction_end + around_action :handle_transaction end private - def transaction_begin + def handle_transaction ApplicationHandleInfo.current = 'application_server' PushMessages.init - end - def transaction_end + yield + Observer::Transaction.commit PushMessages.finish ActiveSupport::Dependencies::Reference.clear! + ensure + ApplicationHandleInfo.current = nil end end