#18251: multithreading deadlock in django.models.loading.get_apps
------------------------------+------------------------------------
Reporter: harm | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Comment (by harm):
Hm. smart. Yes, that would work.
I cannot test it, as the system that reproduced this problem is our
production system.
Note: you '''do''' need something like {{{if not app_cache_ready()}}}, as
{{{ get_apps()}}} actually does a load of work (even when called later),
it '''returns''' the apps list, you don't want that every call. (at least
in django 1.3)
micro optimization:
Als this is really really in a hotspot of the code, storing this state
locally in WSGIHandler, might be faster than calling
{{{app_cache_ready()}}} every request.
so an
{{{
#!python
if not self._apps_initialized:
get_apps() # if entered more that once thats ok, as long as we dont
hit this every request
self._apps_initialized = True
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/18251#comment:3>
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.