Code review comment for lp:~wallyworld/launchpad/projectgroup-timeout-1016156

Revision history for this message
Ian Booth (wallyworld) wrote :

> The two changes to /lib/answers looks wrong. I see that we are converting the
> result set to a list, thus instantiating about 100 FAQs, but we only return 5.
> The change to questiontarget will instantiate several 1000 questions in the U1
> and launchpad project groups. Surely this is slower than how the code it
> currently written. I think the current codes is issue a single query with a
> LIMIT and instantiating just the 5 FAQs or questions wanted. I think we want
> them converted to a list *after* the slice.

Ah, good pickup. My fat fingers mistyped the final bracket. The 2 cases should be fixed now.

The philosophy I'm using is that all cached properties should return a list (not a generator or result set etc which is re-run each time) since this conflicts with the expected semantics that there is no work in calling the cached property a second time. Hence the listification of the result set.

« Back to merge proposal