Merge lp:~edwin-grubbs/launchpad/bug-668047-project-dsp-portlet-timeout into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Robert Collins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11920 |
Proposed branch: | lp:~edwin-grubbs/launchpad/bug-668047-project-dsp-portlet-timeout |
Merge into: | lp:launchpad |
Diff against target: |
213 lines (+45/-38) 5 files modified
lib/lp/registry/browser/tests/product-portlet-packages-view.txt (+3/-3) lib/lp/registry/doc/distribution.txt (+19/-15) lib/lp/registry/model/distribution.py (+14/-12) lib/lp/registry/stories/webservice/xx-distribution.txt (+7/-6) lib/lp/soyuz/browser/tests/distribution-views.txt (+2/-2) |
To merge this branch: | bzr merge lp:~edwin-grubbs/launchpad/bug-668047-project-dsp-portlet-timeout |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Approve | ||
Review via email: mp+39917@code.launchpad.net |
Commit message
Fix timeout finding suggested ubuntu packages to link to a project.
Description of the change
Summary
-------
The project page would timeout when the "Packages in Ubuntu" portlet
would find a huge number of packages matching the project's name that
could be suggested for linking. The subquery for checking the
SourcePackageRe
postgres to use a nested loop, which was very inefficent.
Switching to using a join made it about 200 times faster. Because there
can be multiple SPPH records per DSP, the SELECT had to be made
DISTINCT. The DISTINCT caused some of the tests to break because the
order of the results was nondeterministic when the rank is NULL (i.e.
when a DSP is matched with LIKE as opposed to with the fti). I added the
DSP.name to the ORDER BY clause to make the tests less fragile.
Tests
-----
./bin/test -vv -t 'doc/distributi
Demo and Q/A
------------
* Open https:/
* It should not timeout.
Nice.