about summary refs log tree commit diff
path: root/app/services/follow_remote_account_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/follow_remote_account_service.rb')
-rw-r--r--app/services/follow_remote_account_service.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb
index c4330d7cf..0e23ed7d2 100644
--- a/app/services/follow_remote_account_service.rb
+++ b/app/services/follow_remote_account_service.rb
@@ -13,8 +13,10 @@ class FollowRemoteAccountService < BaseService
     account = Account.find_remote(username, domain)
 
     if account.nil?
+      Rails.logger.debug "Creating new remote account for #{uri}"
       account = Account.new(username: username, domain: domain)
     elsif account.subscribed?
+      Rails.logger.debug "Already subscribed to remote account #{uri}"
       return account
     end
 
@@ -29,7 +31,10 @@ class FollowRemoteAccountService < BaseService
     feed = get_feed(account.remote_url)
     hubs = feed.xpath('//xmlns:link[@rel="hub"]')
 
-    return nil if hubs.empty? || hubs.first.attribute('href').nil? || feed.at_xpath('/xmlns:feed/xmlns:author/xmlns:uri').nil?
+    if hubs.empty? || hubs.first.attribute('href').nil? || feed.at_xpath('/xmlns:feed/xmlns:author/xmlns:uri').nil?
+      Rails.logger.debug "Cannot find PuSH hub or author for #{uri}"
+      return nil
+    end
 
     account.uri     = feed.at_xpath('/xmlns:feed/xmlns:author/xmlns:uri').content
     account.hub_url = hubs.first.attribute('href').value
@@ -49,6 +54,7 @@ class FollowRemoteAccountService < BaseService
 
     return account
   rescue Goldfinger::Error, HTTP::Error
+    Rails.logger.debug "Error while fetching data for #{uri}"
     nil
   end