From 9316c9ea3e0c19fedc33c41e20451c30c032eecf Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 19 Oct 2018 09:55:39 -0400 Subject: [PATCH] implement simple retries for wayward inventory deletes --- awx/main/tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 640a120de7..0a021b9650 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -566,7 +566,7 @@ def update_host_smart_inventory_memberships(): @task() -def delete_inventory(inventory_id, user_id): +def delete_inventory(inventory_id, user_id, retries=5): # Delete inventory as user if user_id is None: user = None @@ -591,7 +591,9 @@ def delete_inventory(inventory_id, user_id): return except DatabaseError: logger.exception('Database error deleting inventory {}, but will retry.'.format(inventory_id)) - # TODO: self.retry(countdown=10) + if retries > 0: + time.sleep(10) + delete_inventory(inventory_id, user_id, retries=retries - 1) def with_path_cleanup(f):