about summary refs log tree commit diff
path: root/app/workers/poll_expiration_notify_worker.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-04 01:06:33 +0100
committerGitHub <noreply@github.com>2022-03-04 01:06:33 +0100
commit2ea754b8610b50cc93aeb1921ecdf7415efaf17e (patch)
tree28906a19f927a53bbe1a1076c74d369a781e3e81 /app/workers/poll_expiration_notify_worker.rb
parent04c3ac896a6054b8158cba06daa9f333f890efd4 (diff)
Fix duplicate notifications being possible after poll expiration (#17697)
Diffstat (limited to 'app/workers/poll_expiration_notify_worker.rb')
-rw-r--r--app/workers/poll_expiration_notify_worker.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/workers/poll_expiration_notify_worker.rb b/app/workers/poll_expiration_notify_worker.rb
index 7613ed5f1..0e29a5f60 100644
--- a/app/workers/poll_expiration_notify_worker.rb
+++ b/app/workers/poll_expiration_notify_worker.rb
@@ -38,12 +38,14 @@ class PollExpirationNotifyWorker
 
   def notify_remote_voters_and_owner!
     ActivityPub::DistributePollUpdateWorker.perform_async(@poll.status.id)
-    NotifyService.new.call(@poll.account, :poll, @poll)
+    LocalNotificationWorker.perform_async(@poll.account_id, @poll.id, 'Poll', 'poll')
   end
 
   def notify_local_voters!
-    @poll.voters.merge(Account.local).find_each do |account|
-      NotifyService.new.call(account, :poll, @poll)
+    @poll.voters.merge(Account.local).select(:id).find_in_batches do |accounts|
+      LocalNotificationWorker.push_bulk(accounts) do |account|
+        [account.id, @poll.id, 'Poll', 'poll']
+      end
     end
   end
 end