diaspora/app/workers/fetch_webfinger.rb
Thorsten Claus 8691e650dc
Person.find_or_fetch_by_identifier never return nil
Person.find_or_fetch_by_identifier raises an exception if person is not found localy and not fetchable. It never returns nil. These code changes take care about this behaviour and changes specs and code to behave equally.

Also related to #8253
2021-08-16 00:24:33 +02:00

20 lines
566 B
Ruby

# frozen_string_literal: true
# Copyright (c) 2010-2012, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module Workers
class FetchWebfinger < Base
sidekiq_options queue: :urgent
def perform(account)
person = Person.find_or_fetch_by_identifier(account)
# also, schedule to fetch a few public posts from that person
Diaspora::Fetcher::Public.queue_for(person)
rescue DiasporaFederation::Discovery::DiscoveryError
# Ignored
end
end
end