Anton Shestakov <av6@dwimlabs.net>, Sat, 16 Jul 2016 19:05:11 +0800
viewer: request light fields when using just metadata from Check
/ and project pages just link to checks, so the heavier text fields like
Check.lines aren't actually important, and can be excluded from SELECT for a
nice performance boost.
--- a/candolint/handlers.py Thu Jul 14 17:04:03 2016 +0800
+++ b/candolint/handlers.py Sat Jul 16 19:05:11 2016 +0800
class IndexHandler(BaseHandler):
- .select(Check, Project, Change)
+ .select(Project, Change, *Check.get_light_fields())
def get(self, domain, user, name):
project = get_project_or_404(domain, user, name)
+ .select(Change, *Check.get_light_fields())
.where(Check.project == project)
--- a/candolint/models.py Thu Jul 14 17:04:03 2016 +0800
+++ b/candolint/models.py Sat Jul 16 19:05:11 2016 +0800
.select(pw.fn.COALESCE(pw.fn.MAX(cls.ordinal), 0))
.where(cls.project == project))
+ def get_light_fields(cls):
+ field for field in cls._meta.fields.values()
+ if not isinstance(field, pw.TextField)