From 6eed794aa00a5ff54c365e8f3921f4c4bc0158f6 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 28 Aug 2023 22:20:46 +0200 Subject: [PATCH] Retry store_lti_session_data We need to store or update the LTI parameters. However, this operation is not atomic and multiple requests can interfere with our database operation. Therefore, we need to retry in case the record is not unique. Fixes CODEOCEAN-TC --- app/controllers/concerns/lti.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/concerns/lti.rb b/app/controllers/concerns/lti.rb index 579e3f32..1f2c76ca 100644 --- a/app/controllers/concerns/lti.rb +++ b/app/controllers/concerns/lti.rb @@ -225,6 +225,8 @@ module Lti @lti_parameters.save! session[:external_user_id] = current_user.id + rescue ActiveRecord::RecordNotUnique + retry end private :store_lti_session_data