Skip to content

Commit

Permalink
fix: Attempt fix for OOM issues when deleting large collections
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Sep 23, 2022
1 parent 3b45f40 commit 7b019f1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions process/management/commands/wiper.py
@@ -1,6 +1,7 @@
import logging

from django.core.management.base import BaseCommand
from django.db import connection
from yapw.methods.blocking import ack

from process.models import Collection
Expand All @@ -12,8 +13,17 @@
logger = logging.getLogger(__name__)


def bulk_batch_size(self, fields, objs):
return 65536 # 2**16


class Command(BaseCommand):
def handle(self, *args, **options):
# Django implements "ON DELETE CASCADE" in Python, not in the database. This causes "InternalError: invalid
# memory alloc request size 1073741824" (1GB) due to the memory required.
# https://code.djangoproject.com/ticket/30533
connection.ops.bulk_batch_size = bulk_batch_size

consume(callback, routing_key, consume_routing_keys, decorator=decorator)


Expand Down

0 comments on commit 7b019f1

Please sign in to comment.