about summary refs log tree commit diff
path: root/lib/mastodon/domains_cli.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-12-14 09:06:34 +0100
committerGitHub <noreply@github.com>2020-12-14 09:06:34 +0100
commit216b85b053d091306e3311a21f5b050f70a75130 (patch)
tree10a6598ad72500a7284e605336e22d36a69cdadd /lib/mastodon/domains_cli.rb
parenta3b5675aa83f7fec4036888e0d94b626ad973f75 (diff)
Fix performance on instances list in admin UI (#15282)
- Reduce duplicate queries
- Remove n+1 queries
- Add accounts count to detailed view
- Add separate action log entry for updating existing domain blocks
Diffstat (limited to 'lib/mastodon/domains_cli.rb')
-rw-r--r--lib/mastodon/domains_cli.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/mastodon/domains_cli.rb b/lib/mastodon/domains_cli.rb
index 5433ddd9d..3c2dfd4ec 100644
--- a/lib/mastodon/domains_cli.rb
+++ b/lib/mastodon/domains_cli.rb
@@ -53,6 +53,8 @@ module Mastodon
       custom_emojis_count = custom_emojis.count
       custom_emojis.destroy_all unless options[:dry_run]
 
+      Instance.refresh unless options[:dry_run]
+
       say("Removed #{custom_emojis_count} custom emojis", :green)
     end
 
@@ -83,7 +85,7 @@ module Mastodon
       processed       = Concurrent::AtomicFixnum.new(0)
       failed          = Concurrent::AtomicFixnum.new(0)
       start_at        = Time.now.to_f
-      seed            = start ? [start] : Account.remote.domains
+      seed            = start ? [start] : Instance.pluck(:domain)
       blocked_domains = Regexp.new('\\.?' + DomainBlock.where(severity: 1).pluck(:domain).join('|') + '$')
       progress        = create_progress_bar