mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Fix inefficiencies in fan-out-on-write service (#14682)
This commit is contained in:
parent
bf477cee9f
commit
ce8f33dd2f
@ -6,8 +6,6 @@ class FanOutOnWriteService < BaseService
|
|||||||
def call(status)
|
def call(status)
|
||||||
raise Mastodon::RaceConditionError if status.visibility.nil?
|
raise Mastodon::RaceConditionError if status.visibility.nil?
|
||||||
|
|
||||||
render_anonymous_payload(status)
|
|
||||||
|
|
||||||
if status.direct_visibility?
|
if status.direct_visibility?
|
||||||
deliver_to_own_conversation(status)
|
deliver_to_own_conversation(status)
|
||||||
elsif status.limited_visibility?
|
elsif status.limited_visibility?
|
||||||
@ -20,6 +18,8 @@ class FanOutOnWriteService < BaseService
|
|||||||
|
|
||||||
return if status.account.silenced? || !status.public_visibility? || status.reblog?
|
return if status.account.silenced? || !status.public_visibility? || status.reblog?
|
||||||
|
|
||||||
|
render_anonymous_payload(status)
|
||||||
|
|
||||||
deliver_to_hashtags(status)
|
deliver_to_hashtags(status)
|
||||||
|
|
||||||
return if status.reply? && status.in_reply_to_account_id != status.account_id
|
return if status.reply? && status.in_reply_to_account_id != status.account_id
|
||||||
@ -58,8 +58,10 @@ class FanOutOnWriteService < BaseService
|
|||||||
def deliver_to_mentioned_followers(status)
|
def deliver_to_mentioned_followers(status)
|
||||||
Rails.logger.debug "Delivering status #{status.id} to limited followers"
|
Rails.logger.debug "Delivering status #{status.id} to limited followers"
|
||||||
|
|
||||||
FeedInsertWorker.push_bulk(status.mentions.includes(:account).map(&:account).select { |mentioned_account| mentioned_account.local? && mentioned_account.following?(status.account) }) do |follower|
|
status.mentions.joins(:account).merge(status.account.followers_for_local_distribution).select(:id).reorder(nil).find_in_batches do |followers|
|
||||||
[status.id, follower.id, :home]
|
FeedInsertWorker.push_bulk(followers) do |follower|
|
||||||
|
[status.id, follower.id, :home]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user