about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2020-06-09 17:26:58 +0900
committerGitHub <noreply@github.com>2020-06-09 10:26:58 +0200
commitd890abfcab076f5df4eafb75397435d32c641e20 (patch)
treeb492373b83e02f46f41259826433163d42f6936c /app/services
parent72a7cfaa395bbddabd0f0a712165fd7babf5d58c (diff)
Fix performance of follow import (#13836)
Diffstat (limited to 'app/services')
-rw-r--r--app/services/import_service.rb4
-rw-r--r--app/services/resolve_account_service.rb2
2 files changed, 5 insertions, 1 deletions
diff --git a/app/services/import_service.rb b/app/services/import_service.rb
index c0d741d57..4cad93767 100644
--- a/app/services/import_service.rb
+++ b/app/services/import_service.rb
@@ -81,7 +81,9 @@ class ImportService < BaseService
       end
     end
 
-    Import::RelationshipWorker.push_bulk(items) do |acct, extra|
+    head_items = items.uniq { |acct, _| acct.split('@')[1] }
+    tail_items = items - head_items
+    Import::RelationshipWorker.push_bulk(head_items + tail_items) do |acct, extra|
       [@account.id, acct, action, extra]
     end
   end
diff --git a/app/services/resolve_account_service.rb b/app/services/resolve_account_service.rb
index 17ace100c..ba77552c6 100644
--- a/app/services/resolve_account_service.rb
+++ b/app/services/resolve_account_service.rb
@@ -112,6 +112,8 @@ class ResolveAccountService < BaseService
   end
 
   def webfinger_update_due?
+    return false if @options[:check_delivery_availability] && !DeliveryFailureTracker.available?(@domain)
+
     @account.nil? || ((!@options[:skip_webfinger] || @account.ostatus?) && @account.possibly_stale?)
   end