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 <claire.github-309c@sitedethib.com>
This commit is contained in:
ThibG 2020-12-20 18:25:00 +01:00 committed by GitHub
parent 9734c9b6fe
commit 7bf3c6e57b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 7 deletions

View file

@ -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|