Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHCLOUD-36102] - Slow loading of data from roles endpoint perfo… #1354

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
710ff4b
[WIP][RHCLOUD-36102] - Slow loading of data from roles endpoint perfo…
EvanCasey13 Nov 29, 2024
3cd7d46
Roles filtering refactor
EvanCasey13 Dec 2, 2024
6849d7b
Roles endpoint filtering continued
EvanCasey13 Dec 3, 2024
cd1dbf0
Roles endpoint filtering - username query parameter handling
EvanCasey13 Dec 4, 2024
2c1caac
Roles endpoint - filtering addition complete
EvanCasey13 Dec 5, 2024
82f2c76
remove print statement from roles test
EvanCasey13 Dec 5, 2024
a221512
Roles endpoint filtering performance done
EvanCasey13 Dec 6, 2024
a49dc74
Pagination readded to roles endpoint
EvanCasey13 Dec 9, 2024
0c72049
Added prefetch_related to base_queryset for access and ext_relations
EvanCasey13 Dec 10, 2024
023ff1b
lint fix
EvanCasey13 Dec 10, 2024
6816159
Removed group_in and group_in_counts from role serializer, will add d…
EvanCasey13 Dec 11, 2024
3bc8ed4
added dynamic annotation and changed role serializer to groups_in field
EvanCasey13 Dec 19, 2024
4e6b58f
Changed to use get_role_queryset from querysets to handle scope/admin…
EvanCasey13 Jan 9, 2025
3d75490
Merge branch 'master' into role_endpoint_performance_improvements
EvanCasey13 Jan 9, 2025
7cce7af
role query reduction from 33 to 24 queries
EvanCasey13 Jan 14, 2025
eeb98de
reduction from to 6 queries for a request for roles endpoint from 33 …
EvanCasey13 Jan 14, 2025
b5a9c74
Merge branch 'master' into role_endpoint_performance_improvements
EvanCasey13 Jan 14, 2025
b8ef8fe
remove redundant default limit for common pagination#
EvanCasey13 Jan 14, 2025
0d9f7e5
Merge branch 'master' into role_endpoint_performance_improvements
EvanCasey13 Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rbac/management/querysets.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ def get_role_queryset(request) -> QuerySet:
"""Obtain the queryset for roles."""
scope = validate_and_get_key(request.query_params, SCOPE_KEY, VALID_SCOPES, ORG_ID_SCOPE)
public_tenant = Tenant.objects.get(tenant_name="public")
base_query = annotate_roles_with_counts(Role.objects.prefetch_related("access")).filter(
tenant__in=[request.tenant, public_tenant]
)
base_query = annotate_roles_with_counts(
Role.objects.prefetch_related("access", "ext_relation", "access__permission")
).filter(tenant__in=[request.tenant, public_tenant])

if scope == PRINCIPAL_SCOPE:
queryset = get_object_principal_queryset(
Expand Down
1 change: 0 additions & 1 deletion rbac/rbac/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@

ALLOWED_HOSTS = ["*"]


# Application definition

INSTALLED_APPS = [
Expand Down
1 change: 1 addition & 0 deletions tests/internal/integration/test_integration_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def test_roles_for_org(self, mock_request):
**self.request.META,
follow=True,
)

self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data.get("meta").get("count"), 1)

Expand Down