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)
writable-api 0.65.6
Ignas Kiela 10 months ago committed by Drew DeVault
parent 554fe3e3e9
commit d75f0e5a29
  1. 4
      todosrht/blueprints/tracker.py

@ -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

Loading…
Cancel
Save