From e25a51eb3d6cead6b0d054470e9e572d6a00e92d Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 14 Feb 2024 17:01:48 +0100 Subject: [PATCH] undo unnecesary atomic statements as per discussion Signed-off-by: Alex --- src/aap_eda/services/activation/manager.py | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/aap_eda/services/activation/manager.py b/src/aap_eda/services/activation/manager.py index 140947dfb..885af7fcc 100644 --- a/src/aap_eda/services/activation/manager.py +++ b/src/aap_eda/services/activation/manager.py @@ -1041,18 +1041,18 @@ def _create_activation_instance(self): if hasattr(self.db_instance, "git_hash") else "" ) - with transaction.atomic(): - if not self.check_new_process_allowed( - self.db_instance_type, - self.db_instance.id, - ): - msg = ( - "Failed to create rulebook process. " - "Reason: Max running processes reached. " - "Waiting for a free slot." - ) - self._set_activation_status(ActivationStatus.PENDING, msg) - raise exceptions.MaxRunningProcessesError + + if not self.check_new_process_allowed( + self.db_instance_type, + self.db_instance.id, + ): + msg = ( + "Failed to create rulebook process. " + "Reason: Max running processes reached. " + "Waiting for a free slot." + ) + self._set_activation_status(ActivationStatus.PENDING, msg) + raise exceptions.MaxRunningProcessesError args = { "name": self.db_instance.name, "status": ActivationStatus.STARTING, @@ -1060,8 +1060,7 @@ def _create_activation_instance(self): } args[f"{self.db_instance_type}"] = self.db_instance try: - with transaction.atomic(): - models.RulebookProcess.objects.create(**args) + models.RulebookProcess.objects.create(**args) except IntegrityError as exc: msg = ( f"Activation {self.db_instance.id} failed to create "