This repository has been archived by the owner on Jan 27, 2020. It is now read-only.
forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mastodon#614 from pixiv/move_clean_up_of_unconfirm…
…ed_users Move clean up of unconfirmed users to sidekiq-scheduler (mastodon#4336)
- Loading branch information
Showing
3 changed files
with
24 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 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 | ||
OauthAuthentication.where(user_id: batch.map(&:id)).delete_all | ||
InitialPasswordUsage.where(user_id: batch.map(&:id)).delete_all | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters