Lower the cleanup_deleted batch size to 50 to reduce overall memory

usage during the cleanup operation
This commit is contained in:
Matthew Jones
2015-05-28 16:30:09 -04:00
parent 094072f9dc
commit 10da862ab1

View File

@@ -81,7 +81,7 @@ class Command(BaseCommand):
pks_to_delete.add(instance.pk) pks_to_delete.add(instance.pk)
# Cleanup objects in batches instead of deleting each one individually. # Cleanup objects in batches instead of deleting each one individually.
if len(pks_to_delete) >= 500: if len(pks_to_delete) >= 50:
model.objects.filter(pk__in=pks_to_delete).delete() model.objects.filter(pk__in=pks_to_delete).delete()
n_deleted_items += len(pks_to_delete) n_deleted_items += len(pks_to_delete)
pks_to_delete.clear() pks_to_delete.clear()