API call in context processor called multiple times

Bug #917263 reported by Gabriel Hurley on 2012-01-16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Gabriel Hurley

Bug Description

The call to tenant_list_for_token() in the horizon context processor is called numerous times for each request. This is because the context is re-generated for each template or template fragment which takes context that is used to render the response for the request. This results in an average of 5-9 calls to the API per request, which is completely unnecessary.

Moving the call to the middleware layer and storing the response on the user object will work far better.

Jay Pipes (jaypipes) wrote :

++. I've noticed this.

Devin Carlen (devcamcar) on 2012-01-16
Changed in horizon:
milestone: none → essex-4
assignee: nobody → Nebula (nebula)
importance: Undecided → High
status: New → Confirmed
Changed in horizon:
assignee: Nebula (nebula) → Gabriel Hurley (gabriel-hurley)
milestone: essex-4 → essex-3
status: Confirmed → In Progress

Reviewed: https://review.openstack.org/3070
Committed: http://github.com/openstack/horizon/commit/a77ed5e534e9ccb9f31baa20480b62fdc8f2430b
Submitter: Jenkins
Branch: master

commit a77ed5e534e9ccb9f31baa20480b62fdc8f2430b
Author: Gabriel Hurley <email address hidden>
Date: Mon Jan 16 10:05:11 2012 -0800

    Moved authorized_tenants retrieval to middleware.

    Fixes bug 917263. By moving the tenant API call from the context
    processor to the middleware the API call is no longer made
    multiple times per request/response cycle.

    Additionally, there are various PEP8 fixes included, with the
    addition of one "ignore" flag to the PEP8 runner (related to
    github issue #34 for pep8.py).

    Change-Id: I5c755dfe381b1c38dbeeb99eb2b7ed9172d16f86

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-01-25
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in horizon:
milestone: essex-3 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers