Join submitters on tracker page loads

Currently it takes ~27 SQL round trips to render a tracker page,
this should remove most of those roundtrips, and improve the
performance of the page (right now it takes ~300ms on average)
This commit is contained in:
Ignas Kiela 2021-12-08 20:07:54 +02:00 committed by Drew DeVault
parent 554fe3e3e9
commit d75f0e5a29
1 changed files with 4 additions and 0 deletions

View File

@ -17,6 +17,8 @@ from todosrht.types import Tracker, Ticket, TicketAccess
from todosrht.urls import tracker_url, ticket_url
from todosrht.webhooks import TrackerWebhook, UserWebhook
from urllib.parse import quote
import sqlalchemy as sa
tracker = Blueprint("tracker", __name__)
@ -101,6 +103,8 @@ def return_tracker(tracker, access, **kwargs):
except ValueError as e:
kwargs["search_error"] = str(e)
tickets = tickets.options(sa.orm.joinedload(Ticket.submitter))
tickets, pagination = paginate_query(tickets, results_per_page=25)
# Find which tickets were seen by the user since last update