From dfc769b8fe021ae7d21eaae7f1e4da7c31af6104 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 20 Jan 2020 13:24:39 -0500 Subject: [PATCH] drastically speed up /api/v2/jobs/N/job_events/ with large counts --- awx/api/views/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 59d0efd722..241c7c6d5c 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -3858,8 +3858,7 @@ class JobJobEventsList(BaseJobEventsList): def get_queryset(self): job = self.get_parent_object() self.check_parent_access(job) - qs = job.job_events - qs = qs.select_related('host') + qs = job.job_events.select_related('host').order_by('start_line') return qs.all()