Skip to content

Commit

Permalink
Avoid duplicate work by merging ReplyDistributionWorker into Distribu…
Browse files Browse the repository at this point in the history
…tionWorker (mastodon#9660)
  • Loading branch information
ClearlyClaire authored and hiyuki2578 committed Oct 2, 2019
1 parent 3a247e7 commit 16c8d05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
1 change: 0 additions & 1 deletion app/services/post_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def call(account, text, in_reply_to = nil, **options)
DistributionWorker.perform_async(status.id)
Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id)
ActivityPub::DistributionWorker.perform_async(status.id)
ActivityPub::ReplyDistributionWorker.perform_async(status.id) if status.reply? && status.thread.account.local?

if options[:idempotency].present?
redis.setex("idempotency:status:#{account.id}:#{options[:idempotency]}", 3_600, status.id)
Expand Down
9 changes: 8 additions & 1 deletion app/workers/activitypub/distribution_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ def relayable?
end

def inboxes
@inboxes ||= @account.followers.inboxes
# Deliver the status to all followers.
# If the status is a reply to another local status, also forward it to that
# status' authors' followers.
@inboxes ||= if @status.reply? && @status.thread.account.local? && @status.distributable?
@account.followers.or(@status.thread.account.followers).inboxes
else
@account.followers.inboxes
end
end

def signed_payload
Expand Down
42 changes: 0 additions & 42 deletions app/workers/activitypub/reply_distribution_worker.rb

This file was deleted.

0 comments on commit 16c8d05

Please sign in to comment.