about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-01-19 14:22:59 +0100
committerGitHub <noreply@github.com>2022-01-19 14:22:59 +0100
commitb209e919bddb4bb72bb4f8589f4b15654f22ef53 (patch)
treeccd980d2d701c03f9c16358908f20560f2d5be2c /app/workers
parentf6acc039ec95c6d1c8cc2e2955f2af31d27e928c (diff)
parentc42938aed4677f52207bbb6389c7edc2772a6f7a (diff)
Merge pull request #1662 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/scheduler/user_cleanup_scheduler.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb
index be0c4277d..d06b637f9 100644
--- a/app/workers/scheduler/user_cleanup_scheduler.rb
+++ b/app/workers/scheduler/user_cleanup_scheduler.rb
@@ -8,6 +8,7 @@ class Scheduler::UserCleanupScheduler
   def perform
     clean_unconfirmed_accounts!
     clean_suspended_accounts!
+    clean_discarded_statuses!
   end
 
   private
@@ -24,4 +25,12 @@ class Scheduler::UserCleanupScheduler
       Admin::AccountDeletionWorker.perform_async(deletion_request.account_id)
     end
   end
+
+  def clean_discarded_statuses!
+    Status.discarded.where('deleted_at <= ?', 30.days.ago).find_in_batches do |statuses|
+      RemovalWorker.push_bulk(statuses) do |status|
+        [status.id, { immediate: true }]
+      end
+    end
+  end
 end