1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Merge pull request #465 from AlanCoding/retry_retry

broaden inventory deletion retry condition
This commit is contained in:
Alan Rominger 2017-09-26 14:48:13 -04:00 committed by GitHub
commit 2ec675cf54

View File

@ -33,7 +33,7 @@ from celery.signals import celeryd_init, worker_process_init, worker_shutdown
# Django # Django
from django.conf import settings from django.conf import settings
from django.db import transaction, DatabaseError, IntegrityError, OperationalError from django.db import transaction, DatabaseError, IntegrityError
from django.utils.timezone import now, timedelta from django.utils.timezone import now, timedelta
from django.utils.encoding import smart_str from django.utils.encoding import smart_str
from django.core.mail import send_mail from django.core.mail import send_mail
@ -451,12 +451,12 @@ def delete_inventory(self, inventory_id, user_id):
{'group_name': 'inventories', 'inventory_id': inventory_id, 'status': 'deleted'} {'group_name': 'inventories', 'inventory_id': inventory_id, 'status': 'deleted'}
) )
logger.debug('Deleted inventory %s as user %s.' % (inventory_id, user_id)) logger.debug('Deleted inventory %s as user %s.' % (inventory_id, user_id))
except OperationalError:
logger.warning('Database error deleting inventory {}, but will retry.'.format(inventory_id))
self.retry(countdown=10)
except Inventory.DoesNotExist: except Inventory.DoesNotExist:
logger.error("Delete Inventory failed due to missing inventory: " + str(inventory_id)) logger.error("Delete Inventory failed due to missing inventory: " + str(inventory_id))
return return
except DatabaseError:
logger.warning('Database error deleting inventory {}, but will retry.'.format(inventory_id))
self.retry(countdown=10)
def with_path_cleanup(f): def with_path_cleanup(f):