1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 22:21:13 +03:00

Merge pull request #2493 from ryanpetrello/celery-inventory-delete-retry

implement simple retries for wayward inventory deletes

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2018-10-19 14:30:04 +00:00 committed by GitHub
commit 41671b5868
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):