From 5c45b25484cf88b4a509d5212d1fef38d64d66bc Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Tue, 15 May 2018 08:17:48 -0400 Subject: [PATCH] Prevent creating excessive update computed tasks when copying an Inventory --- awx/main/tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 31edcc38d7..ccd633a065 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -2352,7 +2352,7 @@ def deep_copy_model_obj( except ObjectDoesNotExist: logger.warning("Object or user no longer exists.") return - with transaction.atomic(): + with transaction.atomic(), ignore_inventory_computed_fields(): copy_mapping = {} for sub_obj_setup in sub_obj_list: sub_model = getattr(importlib.import_module(sub_obj_setup[0]), @@ -2372,3 +2372,5 @@ def deep_copy_model_obj( importlib.import_module(permission_check_func[0]), permission_check_func[1] ), permission_check_func[2]) permission_check_func(creater, copy_mapping.values()) + if isinstance(new_obj, Inventory): + update_inventory_computed_fields.delay(new_obj.id, True)