From 467456f7a19371fe4d50f25751a1d32a63e9f75c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 24 Jul 2017 16:17:55 +0200 Subject: Move clean up of unconfirmed users to sidekiq-scheduler (#4336) * Move clean up of unconfirmed users to sidekiq-scheduler * mastodon:daily is now deprecated --- app/workers/scheduler/user_cleanup_scheduler.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/workers/scheduler/user_cleanup_scheduler.rb (limited to 'app') diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb new file mode 100644 index 000000000..a8f8fbd83 --- /dev/null +++ b/app/workers/scheduler/user_cleanup_scheduler.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true +require 'sidekiq-scheduler' + +class Scheduler::UserCleanupScheduler + include Sidekiq::Worker + + def perform + User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).find_in_batches do |batch| + Account.where(id: batch.map(&:account_id)).delete_all + User.where(id: batch.map(&:id)).delete_all + end + end +end -- cgit