Skip to content

Commit

Permalink
Add code comment about SQL queries in hc.front.views.ping_details
Browse files Browse the repository at this point in the history
  • Loading branch information
cuu508 committed Jan 30, 2025
1 parent a965cee commit b11f239
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hc/front/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ def validate_schedule(request: HttpRequest) -> HttpResponse:
def ping_details(
request: AuthenticatedHttpRequest, code: UUID, n: int | None = None
) -> HttpResponse:
# This view makes two non-obvious SQL queries:
# * it calls ping.get_body(), which reads self.owner.code, triggering a query
# * the template calls ping.duration() which queries past "/start" events

check, rw = _get_check_for_user(request, code)
q = Ping.objects.filter(owner=check)
if n:
Expand Down

0 comments on commit b11f239

Please sign in to comment.