From 7bf3c6e57b52cd9390f2140a1cc17292c281aacf Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 20 Dec 2020 18:25:00 +0100 Subject: Fix AccountDeletionWorker crashing and clogging sidekiq queues (#15380) * Fix account deletion workers being queued multiple times for a single account * Fix poll votes being unnecessarily instantiated on poll deletion * Fix favourites being unnecessarily instantiated on status deletion * Remove inaccurate comments * Delete polls instead of destroying them Co-authored-by: Claire --- app/services/delete_account_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/services/delete_account_service.rb') diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index 9cb80c95a..fe9b30b17 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -122,7 +122,9 @@ class DeleteAccountService < BaseService @account.polls.reorder(nil).find_each do |poll| next if @options[:reserve_username] && reported_status_ids.include?(poll.status_id) - poll.destroy + # We can safely delete the poll rather than destroy it, as any non-reported + # status should have been deleted already + poll.delete end associations_for_destruction.each do |association_name| -- cgit