Kaydet (Commit) 9319f895 authored tarafından Russell Keith-Magee's avatar Russell Keith-Magee

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

Fixed #12452 -- Ensured that all connections are closed when a request 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
üst 1d581cda
......@@ -79,14 +79,15 @@ IntegrityError = backend.IntegrityError
# Register an event that closes the database connection
# when a Django request is finished.
def close_connection(**kwargs):
connection.close()
for conn in connections.all():
conn.close()
signals.request_finished.connect(close_connection)
# Register an event that resets connection.queries
# when a Django request is started.
def reset_queries(**kwargs):
for connection in connections.all():
connection.queries = []
for conn in connections.all():
conn.queries = []
signals.request_started.connect(reset_queries)
# Register an event that rolls back the connections
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment