#17258: Move threading.local from DatabaseWrapper to connections dictionary
-------------------------------------+-------------------------------------
     Reporter:  akaariai             |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  SVN
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by julien):

 * stage:  Design decision needed => Accepted


Comment:

 Accepting as the benefits suggested in comment:3 all seem valid and as we
 already have an immediate need for this, i.e. to allow in-memory sqlite
 database connections being shared between multiple threads for Selenium
 tests (ref #2879).

 The attached patch turns the `DatabaseWrapper` instances into global
 objects and makes the `django.db.connections` and `django.db.connection`
 references thread-local.

 As discussed with akaariai on IRC, there is a potential risk that garbage
 collection may not be handled properly since `DatabaseWrapper` has cyclic
 references. So we'd need to do further testing to be sure this change
 doesn't cause memory leaks or unexpected behaviours.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17258#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to