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:
parent
554fe3e3e9
commit
d75f0e5a29
|
@ -17,6 +17,8 @@ from todosrht.types import Tracker, Ticket, TicketAccess
|
||||||
from todosrht.urls import tracker_url, ticket_url
|
from todosrht.urls import tracker_url, ticket_url
|
||||||
from todosrht.webhooks import TrackerWebhook, UserWebhook
|
from todosrht.webhooks import TrackerWebhook, UserWebhook
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
tracker = Blueprint("tracker", __name__)
|
tracker = Blueprint("tracker", __name__)
|
||||||
|
|
||||||
|
@ -101,6 +103,8 @@ def return_tracker(tracker, access, **kwargs):
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
kwargs["search_error"] = str(e)
|
kwargs["search_error"] = str(e)
|
||||||
|
|
||||||
|
tickets = tickets.options(sa.orm.joinedload(Ticket.submitter))
|
||||||
|
|
||||||
tickets, pagination = paginate_query(tickets, results_per_page=25)
|
tickets, pagination = paginate_query(tickets, results_per_page=25)
|
||||||
|
|
||||||
# Find which tickets were seen by the user since last update
|
# Find which tickets were seen by the user since last update
|
||||||
|
|
Loading…
Reference in New Issue