diff --git a/app/controllers/user/registrations_controller.rb b/app/controllers/user/registrations_controller.rb index fa900ea1..0413dcd4 100644 --- a/app/controllers/user/registrations_controller.rb +++ b/app/controllers/user/registrations_controller.rb @@ -8,8 +8,8 @@ class User::RegistrationsController < Devise::RegistrationsController end def destroy - DeletionWorker.perform_async(resource.id) Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name) + resource.destroy set_flash_message :notice, :destroyed if is_flashing_format? yield resource if block_given? respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) } diff --git a/app/models/user.rb b/app/models/user.rb index 3c8e9b18..f9449888 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -27,28 +27,28 @@ class User < ApplicationRecord # attr_accessor :login - has_many :questions, dependent: :destroy - has_many :answers, dependent: :destroy - has_many :comments, dependent: :destroy - has_many :inboxes, dependent: :destroy - has_many :smiles, class_name: "Appendable::Reaction", dependent: :destroy - has_many :services, dependent: :destroy - has_many :notifications, foreign_key: :recipient_id, dependent: :destroy - has_many :reports, dependent: :destroy - has_many :moderation_comments, dependent: :destroy - has_many :moderation_votes, dependent: :destroy - has_many :lists, dependent: :destroy - has_many :list_memberships, class_name: "ListMember", foreign_key: 'user_id', dependent: :destroy - has_many :mute_rules, dependent: :destroy - has_many :anonymous_blocks, dependent: :destroy + has_many :questions, dependent: :destroy_async + has_many :answers, dependent: :destroy_async + has_many :comments, dependent: :destroy_async + has_many :inboxes, dependent: :destroy_async + has_many :smiles, class_name: "Appendable::Reaction", dependent: :destroy_async + has_many :services, dependent: :destroy_async + has_many :notifications, foreign_key: :recipient_id, dependent: :destroy_async + has_many :reports, dependent: :destroy_async + has_many :moderation_comments, dependent: :destroy_async + has_many :moderation_votes, dependent: :destroy_async + has_many :lists, dependent: :destroy_async + has_many :list_memberships, class_name: "ListMember", foreign_key: 'user_id', dependent: :destroy_async + has_many :mute_rules, dependent: :destroy_async + has_many :anonymous_blocks, dependent: :destroy_async - has_many :subscriptions, dependent: :destroy - has_many :totp_recovery_codes, dependent: :destroy + has_many :subscriptions, dependent: :destroy_async + has_many :totp_recovery_codes, dependent: :destroy_async - has_one :profile, dependent: :destroy - has_one :theme, dependent: :destroy + has_one :profile, dependent: :destroy_async + has_one :theme, dependent: :destroy_async - has_many :bans, class_name: 'UserBan', dependent: :destroy + has_many :bans, class_name: 'UserBan', dependent: :destroy_async has_many :banned_users, class_name: 'UserBan', foreign_key: 'banned_by_id', dependent: :nullify diff --git a/app/workers/deletion_worker.rb b/app/workers/deletion_worker.rb deleted file mode 100644 index 142c0a1c..00000000 --- a/app/workers/deletion_worker.rb +++ /dev/null @@ -1,15 +0,0 @@ -class DeletionWorker - include Sidekiq::Worker - - sidekiq_options queue: :deletion, retry: false - - # @param resource_id [Integer] user id passed from Devise - def perform(resource_id) - begin - User.find(resource_id).destroy! - rescue => e - logger.info "failed to delete user: #{e.message}" - Sentry.capture_exception(e) - end - end -end diff --git a/config/sidekiq.yml b/config/sidekiq.yml index fd4423fd..2236bdc5 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -6,10 +6,10 @@ staging: production: :concurrency: 25 :queues: + - default - share - carrierwave - mailers - - deletion - question - export