mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Deduplicate unique accounts and limit account array in descendants CTE
Limit unique accounts to check blocks from to 30 unique accounts (any new participant will have its blocks ignored for the purpose of displaying the posts). This is extremely unlikely to be reached in a legitimate situation, but would limit wasteful computation in specially-crafted threads with many participants.
This commit is contained in:
parent
c3f5de4269
commit
ceeed33c98
1 changed files with 5 additions and 1 deletions
|
@ -84,7 +84,11 @@ module Status::ThreadingConcern
|
|||
UNION ALL
|
||||
|
||||
SELECT
|
||||
statuses.id, path || statuses.id, authors || statuses.account_id
|
||||
statuses.id, path || statuses.id, (CASE
|
||||
WHEN array_length(authors, 1) >= 30 THEN authors
|
||||
WHEN statuses.account_id = ANY(authors) THEN authors
|
||||
ELSE authors || statuses.account_id
|
||||
END)
|
||||
FROM
|
||||
search_tree
|
||||
JOIN
|
||||
|
|
Loading…
Reference in a new issue