Distribution/DistroSeries overview wastes time querying languages and countries
Bug #515702 reported by
Jeroen T. Vermeulen
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Jeroen T. Vermeulen |
Bug Description
We're seeing some timeouts for the Distribution and DistroSeries translation overview pages because they spend too much time looking up languages by code, and to a slightly lesser extent, countries and the languages that are spoken in them.
The language lookups in particular are pointless. We're querying Language by code about 10× as many times as there are languages listed in the overview. Some kind of caching and/or bulk-fetching seems in order.
OOPS-1492A1007, OOPS-1492A1146, OOPS-1492A1282, OOPS-1492A1362, OOPS-1492A1372
OOPS-1492A1456, OOPS-1492B1114, OOPS-1492B1170, OOPS-1492B1292, OOPS-1492B1533
OOPS-1492B1450, OOPS-1492D1484, OOPS-1492G1554, OOPS-1492G2077, OOPS-1492H60
Related branches
lp:~jtv/launchpad/bug-515702
Merged
into
lp:launchpad
- Muharem Hrnjadovic (community): Approve (code)
-
Diff: 12 lines (+1/-1)1 file modifiedlib/lp/translations/browser/translations.py (+1/-1)
summary: |
- Distribution/DistroSeries overview wastes time querying languges and + Distribution/DistroSeries overview wastes time querying languages and countries |
Changed in rosetta: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The cause seems to be that isPreferredLanguage indirectly looks up TranslationsMix in.translatable _languages, which uses preferred_ or_request_ languages from the Launchpad helpers, which in turn queries all of the languages set as the user's preferred languages or accepted by the http[s] request.
Since this is browser code, we can just make translatable_ languages a @cachedproperty. It doesn't break any pagetests, and it looks like it'd knock >10 seconds off each of the timed-out requests.