mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Prevented unlimited memory consumption when running background tasks with DEBUG=True. Thanks Rob, Alex, Baptiste, and others.
This commit is contained in:
@@ -91,7 +91,7 @@ class BulkCreateTests(TestCase):
|
||||
|
||||
def test_large_batch(self):
|
||||
with override_settings(DEBUG=True):
|
||||
connection.queries = []
|
||||
connection.queries_log.clear()
|
||||
TwoFields.objects.bulk_create([
|
||||
TwoFields(f1=i, f2=i + 1) for i in range(0, 1001)
|
||||
])
|
||||
@@ -112,7 +112,7 @@ class BulkCreateTests(TestCase):
|
||||
@skipUnlessDBFeature('has_bulk_insert')
|
||||
def test_large_batch_efficiency(self):
|
||||
with override_settings(DEBUG=True):
|
||||
connection.queries = []
|
||||
connection.queries_log.clear()
|
||||
TwoFields.objects.bulk_create([
|
||||
TwoFields(f1=i, f2=i + 1) for i in range(0, 1001)
|
||||
])
|
||||
@@ -124,7 +124,7 @@ class BulkCreateTests(TestCase):
|
||||
mixed together with objects without PK set.
|
||||
"""
|
||||
with override_settings(DEBUG=True):
|
||||
connection.queries = []
|
||||
connection.queries_log.clear()
|
||||
TwoFields.objects.bulk_create([
|
||||
TwoFields(id=i if i % 2 == 0 else None, f1=i, f2=i + 1)
|
||||
for i in range(100000, 101000)])
|
||||
@@ -142,7 +142,7 @@ class BulkCreateTests(TestCase):
|
||||
mixed together with objects without PK set.
|
||||
"""
|
||||
with override_settings(DEBUG=True):
|
||||
connection.queries = []
|
||||
connection.queries_log.clear()
|
||||
TwoFields.objects.bulk_create([
|
||||
TwoFields(id=i if i % 2 == 0 else None, f1=i, f2=i + 1)
|
||||
for i in range(100000, 101000)])
|
||||
|
||||
Reference in New Issue
Block a user