Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12452 -- Ensured that all connections are closed when a reques…

…t is finished. Thanks to samuel@lefora.com for the report and fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9319f895478c60717a7cf2cf132ad7fa4440b4f8 1 parent 1d581cd
Russell Keith-Magee authored December 28, 2009

Showing 1 changed file with 4 additions and 3 deletions. Show diff stats Hide diff stats

  1. 7  django/db/__init__.py
7  django/db/__init__.py
@@ -79,14 +79,15 @@
79 79
 # Register an event that closes the database connection
80 80
 # when a Django request is finished.
81 81
 def close_connection(**kwargs):
82  
-    connection.close()
  82
+    for conn in connections.all():
  83
+        conn.close()
83 84
 signals.request_finished.connect(close_connection)
84 85
 
85 86
 # Register an event that resets connection.queries
86 87
 # when a Django request is started.
87 88
 def reset_queries(**kwargs):
88  
-    for connection in connections.all():
89  
-        connection.queries = []
  89
+    for conn in connections.all():
  90
+        conn.queries = []
90 91
 signals.request_started.connect(reset_queries)
91 92
 
92 93
 # Register an event that rolls back the connections

0 notes on commit 9319f89

Please sign in to comment.
Something went wrong with that request. Please try again.