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

AC-982 Fixes for inventory import speed when deleting groups.

This commit is contained in:
Chris Church 2014-02-04 22:55:44 -05:00
parent 033968a0a9
commit ce56f1c17d
2 changed files with 3 additions and 2 deletions

View File

@ -523,7 +523,7 @@ class Command(NoArgsCommand):
del_groups = del_groups.exclude(name__in=self.all_group.all_groups.keys())
for group in del_groups:
group_name = group.name
group.mark_inactive()
group.mark_inactive(recompute=False)
self.logger.info('Group "%s" deleted', group_name)
# If overwrite is set, clear all invalid child relationships for groups

View File

@ -143,7 +143,7 @@ def migrate_children_from_deleted_group_to_parent_groups(sender, **kwargs):
except Inventory.DoesNotExist:
pass
@receiver(pre_save, sender=Group)
receiver(pre_save, sender=Group)
def save_related_pks_before_group_marked_inactive(sender, **kwargs):
if getattr(_inventory_updates, 'is_removing', False):
return
@ -187,6 +187,7 @@ def migrate_children_from_inactive_group_to_parent_groups(sender, **kwargs):
except InventorySource.DoesNotExist:
pass
inventory_pk = getattr(instance, '_saved_inventory_pk', None)
if not getattr(_inventory_updates, 'is_updating', False):
if inventory_pk:
try:
inventory = Inventory.objects.get(pk=inventory_pk, active=True)