1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

Merge pull request #4487 from ryanpetrello/many-groups-slowness

optimize a slow query in inventory script generation

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-08-14 20:32:01 +00:00 committed by GitHub
commit ad17bdc559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,7 +309,7 @@ class Inventory(CommonModelNameNotUnique, ResourceMixin, RelatedJobsMixin):
# Now use in-memory maps to build up group info. # Now use in-memory maps to build up group info.
all_group_names = [] all_group_names = []
for group in self.groups.only('name', 'id', 'variables'): for group in self.groups.only('name', 'id', 'variables', 'inventory_id'):
group_info = dict() group_info = dict()
if group.id in group_hosts_map: if group.id in group_hosts_map:
group_info['hosts'] = group_hosts_map[group.id] group_info['hosts'] = group_hosts_map[group.id]