diff options
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/account_deletion_worker.rb | 5 | ||||
-rw-r--r-- | app/workers/poll_expiration_notify_worker.rb | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/app/workers/account_deletion_worker.rb b/app/workers/account_deletion_worker.rb index 0f6be71e1..81c3b91ad 100644 --- a/app/workers/account_deletion_worker.rb +++ b/app/workers/account_deletion_worker.rb @@ -5,8 +5,9 @@ class AccountDeletionWorker sidekiq_options queue: 'pull' - def perform(account_id) - DeleteAccountService.new.call(Account.find(account_id), reserve_username: true, reserve_email: false) + def perform(account_id, options = {}) + reserve_username = options.with_indifferent_access.fetch(:reserve_username, true) + DeleteAccountService.new.call(Account.find(account_id), reserve_username: reserve_username, reserve_email: false) rescue ActiveRecord::RecordNotFound true end diff --git a/app/workers/poll_expiration_notify_worker.rb b/app/workers/poll_expiration_notify_worker.rb index 8a12fc075..f0191d479 100644 --- a/app/workers/poll_expiration_notify_worker.rb +++ b/app/workers/poll_expiration_notify_worker.rb @@ -15,7 +15,7 @@ class PollExpirationNotifyWorker end # Notify local voters - poll.votes.includes(:account).map(&:account).select(&:local?).each do |account| + poll.votes.includes(:account).group(:account_id).select(:account_id).map(&:account).select(&:local?).each do |account| NotifyService.new.call(account, :poll, poll) end rescue ActiveRecord::RecordNotFound |