mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Skip followers synchronization for accounts with 25k followers or more (#37302)
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::DistributionWorker < ActivityPub::RawDistributionWorker
|
class ActivityPub::DistributionWorker < ActivityPub::RawDistributionWorker
|
||||||
|
# Skip followers synchronization for accounts with a large number of followers,
|
||||||
|
# as this is expensive and people with very large amounts of followers
|
||||||
|
# necessarily have less control over them to begin with
|
||||||
|
MAX_FOLLOWERS_FOR_SYNCHRONIZATION = 25_000
|
||||||
|
|
||||||
# Distribute a new status or an edit of a status to all the places
|
# Distribute a new status or an edit of a status to all the places
|
||||||
# where the status is supposed to go or where it was interacted with
|
# where the status is supposed to go or where it was interacted with
|
||||||
def perform(status_id)
|
def perform(status_id)
|
||||||
@@ -27,6 +32,6 @@ class ActivityPub::DistributionWorker < ActivityPub::RawDistributionWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def options
|
def options
|
||||||
{ 'synchronize_followers' => @status.private_visibility? }
|
{ 'synchronize_followers' => @status.private_visibility? && @account.followers_count < MAX_FOLLOWERS_FOR_SYNCHRONIZATION }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user