[buildinfo.debian.net] 03/03: Optimise new API call.
Chris Lamb
chris at chris-lamb.co.uk
Wed Oct 25 01:39:55 UTC 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository buildinfo.debian.net.
commit 5696a968f74ec939a3ce41e010de9a13d953d2b3
Author: Chris Lamb <lamby at debian.org>
Date: Tue Oct 24 21:39:41 2017 -0400
Optimise new API call.
---
bidb/packages/views.py | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/bidb/packages/views.py b/bidb/packages/views.py
index 5f755d6..aba02c5 100644
--- a/bidb/packages/views.py
+++ b/bidb/packages/views.py
@@ -108,9 +108,23 @@ def api_source_version_architecture(request, name, version, architecture):
).select_related(
'key',
'buildinfo',
- ).order_by(
+ 'buildinfo__architecture',
+ 'buildinfo__source',
+ ).only(
+ 'slug',
'buildinfo__sha1',
+ 'buildinfo__version',
+ 'buildinfo__source__name',
+ 'buildinfo__architecture__name',
+ 'key__name',
+ 'key__uid',
'created',
+ ).order_by()
+
+ grouped = groupby(
+ sorted(qs, key=lambda x: (x.buildinfo.sha1, x.created)),
+ lambda x: x.buildinfo.sha1,
+ lambda x: x.created,
)
by_sha1 = [
@@ -128,11 +142,7 @@ def api_source_version_architecture(request, name, version, architecture):
'created': x.created,
} for x in xs],
}
- for sha1, xs in groupby(
- qs,
- lambda x: x.buildinfo.sha1,
- lambda x: x.created,
- )
+ for sha1, xs in grouped
]
return JsonResponse({'by_sha1': by_sha1})
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/buildinfo.debian.net.git
More information about the Reproducible-commits
mailing list