Skip to content

Commit

Permalink
Check for instance availability before attempting to fetch mentioned …
Browse files Browse the repository at this point in the history
…users (mastodon#22713)
  • Loading branch information
dwrss committed Jul 6, 2023
1 parent 5f51596 commit da7588a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/lib/activitypub/activity/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,13 @@ def process_mention(tag)
return if tag['href'].blank?

account = account_from_uri(tag['href'])
account = ActivityPub::FetchRemoteAccountService.new.call(tag['href'], request_id: @options[:request_id]) if account.nil?

begin
return unless DeliveryFailureTracker.available?(@domain) || !account.nil
account = ActivityPub::FetchRemoteAccountService.new.call(tag['href'], request_id: @options[:request_id]) if account.nil?
rescue HTTP::ConnectionError => e
Rails.logger.info "Fetching account #{tag['href']} failed: #{e}"
raise
end
return if account.nil?

@mentions << Mention.new(account: account, silent: false)
Expand Down

0 comments on commit da7588a

Please sign in to comment.