mirror of
https://github.com/ansible/awx.git
synced 2026-02-15 10:10:01 -03:30
apply optimizations via standard method
This addresses the top-level resources in the v2 root view, focusing in order of priority, reflecting use by the UI. In several cases get_queryset logic from the view is moved into the access class. Most other cases involve adding a straightforward select_related or prefetch_related entry. All additional confirmed to be effective with the django debug toolbar.
This commit is contained in:
@@ -167,7 +167,7 @@ class ApiV1PingView(APIView):
|
||||
capacity=instance.capacity, version=instance.version))
|
||||
sorted(response['instances'], key=operator.itemgetter('node'))
|
||||
response['instance_groups'] = []
|
||||
for instance_group in InstanceGroup.objects.all():
|
||||
for instance_group in InstanceGroup.objects.prefetch_related('instances'):
|
||||
response['instance_groups'].append(dict(name=instance_group.name,
|
||||
capacity=instance_group.capacity,
|
||||
instances=[x.hostname for x in instance_group.instances.all()]))
|
||||
|
||||
Reference in New Issue
Block a user