From 5af849285b2af6123644b09b530bee4578e126b6 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Thu, 11 Jul 2024 14:50:42 +0100 Subject: [PATCH] Call after_expired after expiration Currently we call it within a transaction, but this doens't work as some expiration triggers will send emails, and therefore try and fetch data from the database while it's still within the transaction only. --- app/services/expire_requestable.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/expire_requestable.rb b/app/services/expire_requestable.rb index 68342a1092..e636bddc0f 100644 --- a/app/services/expire_requestable.rb +++ b/app/services/expire_requestable.rb @@ -13,7 +13,6 @@ def call ActiveRecord::Base.transaction do requestable.expired! - requestable.after_expired(user:) CreateTimelineEvent.call( "requestable_expired", @@ -25,6 +24,8 @@ def call ApplicationFormStatusUpdater.call(user:, application_form:) end + requestable.after_expired(user:) + requestable end