From 273a9b94dee16d5e77172c2b79433d6c20abf4a8 Mon Sep 17 00:00:00 2001
From: multiple creatures <dev@multiple-creature.party>
Date: Tue, 3 Dec 2019 17:24:58 -0600
Subject: add `monsterfork:reapply_filters` task to mass-fix users' tl filters
 for this update

---
 lib/tasks/monsterfork.rake | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'lib/tasks')

diff --git a/lib/tasks/monsterfork.rake b/lib/tasks/monsterfork.rake
index 465299562..6c2f5074a 100644
--- a/lib/tasks/monsterfork.rake
+++ b/lib/tasks/monsterfork.rake
@@ -37,4 +37,16 @@ namespace :monsterfork do
   task reindex_media_descs: :environment do
     index_statuses(Status.left_outer_joins(:media_attachments).where('media_attachments.description IS NOT NULL'))
   end
+
+  desc "Re-apply all users' filters to their home and list timelines."
+  task reapply_filters: :environment do
+    Account.local.find_each do |account|
+      Rails.logger.info("Re-applying filters for: #{account.username}")
+      FilterFeedsWorker.perform_async(account.id)
+      sleep 1
+      while Sidekiq::Queue.new.size > 5
+        sleep 1
+      end
+    end
+  end
 end
-- 
cgit