Skip to content

Commit

Permalink
Remove prefetch_related on collaboration call
Browse files Browse the repository at this point in the history
In development mode, removing this prefetch increases both the SQL queries and CPU load, but for some reason allows the page to actually load in the staging environment. So, I want to deploy this to see if it changes anything in production.
  • Loading branch information
nikolas authored Jan 8, 2025
1 parent 3b73c2b commit 2f63746
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions structuredcollaboration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,7 @@ def get_children_for_object(self, obj, author=None):
if author and not author.is_anonymous:
queryset = queryset.filter(Q(user=author) | Q(group__user=author))

return queryset.select_related(
'user', 'group', 'policy_record'
).prefetch_related(
'content_object',
'content_object__author',
'content_object__participants',
'content_object__collaboration')
return queryset.select_related('user', 'group', 'policy_record')

def get_top_ancestor(self): # i.e. domain
result = self
Expand Down

0 comments on commit 2f63746

Please sign in to comment.