From cfcca7ccce3dc527d16757ff6dc978e50c4a2e61 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 7 Jun 2014 14:09:27 +0200 Subject: Fixed #3711, #6734, #12581 -- Bounded connection.queries. Prevented unlimited memory consumption when running background tasks with DEBUG=True. Thanks Rob, Alex, Baptiste, and others. --- django/test/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django/test') diff --git a/django/test/utils.py b/django/test/utils.py index fdbf920868..9a0d7a494c 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -509,7 +509,7 @@ class CaptureQueriesContext(object): def __enter__(self): self.use_debug_cursor = self.connection.use_debug_cursor self.connection.use_debug_cursor = True - self.initial_queries = len(self.connection.queries) + self.initial_queries = len(self.connection.queries_log) self.final_queries = None request_started.disconnect(reset_queries) return self @@ -519,7 +519,7 @@ class CaptureQueriesContext(object): request_started.connect(reset_queries) if exc_type is not None: return - self.final_queries = len(self.connection.queries) + self.final_queries = len(self.connection.queries_log) class IgnoreDeprecationWarningsMixin(object): -- cgit v1.3