about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--db/migrate/20200407202420_migrate_unavailable_inboxes.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/db/migrate/20200407202420_migrate_unavailable_inboxes.rb b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
index 0dce26c6f..92a3acb5d 100644
--- a/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
+++ b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
@@ -4,8 +4,13 @@ class MigrateUnavailableInboxes < ActiveRecord::Migration[5.2]
   def up
     urls = Redis.current.smembers('unavailable_inboxes')
 
-    urls.each do |url|
-      host = Addressable::URI.parse(url).normalized_host
+    hosts = urls.map do |url|
+      Addressable::URI.parse(url).normalized_host
+    end.compact.uniq
+
+    UnavailableDomain.delete_all
+
+    hosts.each do |host|
       UnavailableDomain.create(domain: host)
     end