]> git.ipfire.org Git - thirdparty/patchwork.git/commit
xmlrpc: Don't load all Patches into memory
authorStephen Finucane <stephen.finucane@intel.com>
Wed, 13 Jul 2016 09:57:29 +0000 (10:57 +0100)
committerStephen Finucane <stephenfinucane@hotmail.com>
Sat, 13 Aug 2016 22:36:38 +0000 (23:36 +0100)
commit5b70ecf7d318cbf3c6badb9203adec873970b907
tree4598712a1301eb0898c8f45b05659482e9a02919
parentbe2aab7170e026536720e940b7b9ed54e240c895
xmlrpc: Don't load all Patches into memory

The way that reverse indexing of patches was implemented is broken.
At present, it will retrieve all patches in memory and return the
length from that data, then the slicing operation will then happen
without querying the DB and slice the results cached from the len()
evaluation. This is memory intensive, particularly for larger
instances.

Take advantage of Django's lazy loading to avoid this.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Suggested-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
patchwork/views/xmlrpc.py