kopia lustrzana https://gitlab.com/marnanel/chapeau
Better logging for inbox calculation
rodzic
3ad00cfae0
commit
31dede8c2c
|
@ -597,24 +597,46 @@ class LocalPerson(Person):
|
|||
|
||||
all_your_posts = Q(account = self)
|
||||
|
||||
# note: querysets don't get evaluated unless used,
|
||||
# so the debug logging doesn't cause a db hit
|
||||
# unless it's actually turned on.
|
||||
|
||||
logger.debug("%s.inbox: your own posts: %s",
|
||||
self,
|
||||
trilby_models.Status.objects.filter(
|
||||
all_your_posts
|
||||
))
|
||||
|
||||
all_your_friends_public_posts = Q(
|
||||
visibility = trilby_utils.VISIBILITY_PUBLIC,
|
||||
account__rel_followers__follower = self,
|
||||
)
|
||||
|
||||
logger.debug("%s.inbox: your friends' public posts: %s",
|
||||
self,
|
||||
trilby_models.Status.objects.filter(
|
||||
all_your_friends_public_posts
|
||||
))
|
||||
|
||||
all_your_mutuals_private_posts = Q(
|
||||
visibility = trilby_utils.VISIBILITY_PRIVATE,
|
||||
account__rel_following__following = self,
|
||||
account__rel_followers__follower = self,
|
||||
)
|
||||
|
||||
logger.debug("%s.inbox: your mutuals' private posts: %s",
|
||||
self,
|
||||
trilby_models.Status.objects.filter(
|
||||
all_your_mutuals_private_posts
|
||||
))
|
||||
|
||||
result = trilby_models.Status.objects.filter(
|
||||
all_your_posts | \
|
||||
all_your_friends_public_posts | \
|
||||
all_your_mutuals_private_posts
|
||||
)
|
||||
|
||||
logger.debug("%s.inbox: contains %s",
|
||||
logger.info("%s.inbox: contains %s",
|
||||
self, result)
|
||||
|
||||
return result
|
||||
|
|
Ładowanie…
Reference in New Issue