mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
Remove optimizations with adverse effects
`if not audience` actually causes the entire query to be evaluated, before .values_list() is called.
This commit is contained in:
parent
439cb3ccaa
commit
e1c54b2933
1 changed files with 1 additions and 5 deletions
|
@ -183,8 +183,6 @@ class HomeStream(ActivityStream):
|
||||||
def get_audience(self, status):
|
def get_audience(self, status):
|
||||||
trace.get_current_span().set_attribute("stream_id", self.key)
|
trace.get_current_span().set_attribute("stream_id", self.key)
|
||||||
audience = super()._get_audience(status)
|
audience = super()._get_audience(status)
|
||||||
if not audience:
|
|
||||||
return []
|
|
||||||
# if the user is following the author
|
# if the user is following the author
|
||||||
audience = audience.filter(following=status.user).values_list("id", flat=True)
|
audience = audience.filter(following=status.user).values_list("id", flat=True)
|
||||||
# if the user is the post's author
|
# if the user is the post's author
|
||||||
|
@ -239,9 +237,7 @@ class BooksStream(ActivityStream):
|
||||||
)
|
)
|
||||||
|
|
||||||
audience = super()._get_audience(status)
|
audience = super()._get_audience(status)
|
||||||
if not audience:
|
return audience.filter(shelfbook__book__parent_work=work)
|
||||||
return models.User.objects.none()
|
|
||||||
return audience.filter(shelfbook__book__parent_work=work).distinct()
|
|
||||||
|
|
||||||
def get_audience(self, status):
|
def get_audience(self, status):
|
||||||
# only show public statuses on the books feed,
|
# only show public statuses on the books feed,
|
||||||
|
|
Loading…
Reference in a new issue