~sircmpwn/builds.sr.ht

4a7a43276e15ae2ae314a63dc88ca1b6cf130bb3 — Drew DeVault 5 days ago 92ee785 master 0.56.12
Use joinedload on jobs page

This improves the performance of the query while fetching related tasks.
1 files changed, 3 insertions(+), 1 deletions(-)

M buildsrht/blueprints/jobs.py
M buildsrht/blueprints/jobs.py => buildsrht/blueprints/jobs.py +3 -1
@@ 13,6 13,7 @@ from buildsrht.rss import generate_feed
from buildsrht.runner import queue_build
from buildsrht.search import apply_search
from jinja2 import Markup, escape
import sqlalchemy as sa
import hashlib
import requests
import yaml


@@ 91,7 92,8 @@ def jobs_page(jobs, sidebar="sidebar.html", **kwargs):
    search_error = None

    try:
        jobs = get_jobs(jobs, search)
        jobs = (get_jobs(jobs, search)
            .options(sa.orm.joinedload(Job.tasks)))
    except ValueError as ex:
        search_error = str(ex)