mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 11:57:37 -02:30
Optimize query for job events for a single job to speed up loading job details page.
This commit is contained in:
@@ -3502,6 +3502,16 @@ class JobJobEventsList(BaseJobEventsList):
|
||||
|
||||
parent_model = Job
|
||||
|
||||
def get_queryset(self):
|
||||
job = self.get_parent_object()
|
||||
self.check_parent_access(job)
|
||||
qs = job.job_events.all()
|
||||
qs = qs.select_related('host')
|
||||
qs = qs.prefetch_related('hosts', 'children')
|
||||
if self.request.user.is_superuser or self.request.user.is_system_auditor:
|
||||
return qs.all()
|
||||
return qs.filter(Q(host__isnull=True) | Q(host__in=host_qs))
|
||||
|
||||
|
||||
class JobJobPlaysList(BaseJobEventsList):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user