From 8387b3928ec7658192907da79df65e65aaa8a7fc Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Tue, 18 Jul 2017 16:25:40 +0200 Subject: fix(push-subscriptions): Refactor how Sidekiq jobs are handled (#4226) --- app/services/notify_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/services') diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 0ab61b634..c7d8ad50a 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -65,7 +65,11 @@ class NotifyService < BaseService end def send_push_notifications - WebPushNotificationWorker.perform_async(@recipient.id, @notification.id) + sessions_with_subscriptions_ids = @recipient.user.session_activations.where.not(web_push_subscription: nil).pluck(:id) + + WebPushNotificationWorker.push_bulk(sessions_with_subscriptions_ids) do |session_activation_id| + [session_activation_id, @notification.id] + end end def send_email -- cgit