about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-12-20 18:25:00 +0100
committerGitHub <noreply@github.com>2020-12-20 18:25:00 +0100
commit7bf3c6e57b52cd9390f2140a1cc17292c281aacf (patch)
treeadde2393c2ba14cc18368670a058802c57b6dc45 /app/services
parent9734c9b6fe2d2e4a980d8ad94c5de0300b23c809 (diff)
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>
Diffstat (limited to 'app/services')
-rw-r--r--app/services/batched_remove_status_service.rb3
-rw-r--r--app/services/delete_account_service.rb4
2 files changed, 3 insertions, 4 deletions
diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb
index 2295a01dc..28e5468b3 100644
--- a/app/services/batched_remove_status_service.rb
+++ b/app/services/batched_remove_status_service.rb
@@ -4,8 +4,6 @@ class BatchedRemoveStatusService < BaseService
   include Redisable
 
   # Delete given statuses and reblogs of them
-  # Dispatch PuSH updates of the deleted statuses, but only local ones
-  # Dispatch Salmon deletes, unique per domain, of the deleted statuses, but only local ones
   # Remove statuses from home feeds
   # Push delete events to streaming API for home feeds and public feeds
   # @param [Enumerable<Status>] statuses A preferably batched array of statuses
@@ -19,7 +17,6 @@ class BatchedRemoveStatusService < BaseService
 
     @json_payloads = statuses.each_with_object({}) { |s, h| h[s.id] = Oj.dump(event: :delete, payload: s.id.to_s) }
 
-    # Ensure that rendered XML reflects destroyed state
     statuses.each do |status|
       status.mark_for_mass_destruction!
       status.destroy
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|