mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
move various items to prefetch for optimization
This commit is contained in:
parent
75a85cdab2
commit
a90bafe6f0
@ -1024,6 +1024,7 @@ class ProjectList(ListCreateAPIView):
|
||||
'update_role',
|
||||
'read_role',
|
||||
)
|
||||
projects_qs = projects_qs.prefetch_related('last_job', 'created_by')
|
||||
return projects_qs
|
||||
|
||||
|
||||
@ -1579,6 +1580,7 @@ class InventoryList(ListCreateAPIView):
|
||||
def get_queryset(self):
|
||||
qs = Inventory.accessible_objects(self.request.user, 'read_role')
|
||||
qs = qs.select_related('admin_role', 'read_role', 'update_role', 'use_role', 'adhoc_role')
|
||||
qs = qs.prefetch_related('created_by', 'modified_by', 'organization')
|
||||
return qs
|
||||
|
||||
|
||||
|
||||
@ -1808,6 +1808,9 @@ class UnifiedJobTemplateAccess(BaseAccess):
|
||||
'created_by',
|
||||
'modified_by',
|
||||
'next_schedule',
|
||||
)
|
||||
# prefetch last/current jobs so we get the real instance
|
||||
qs = qs.prefetch_related(
|
||||
'last_job',
|
||||
'current_job',
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user