0
0
Fork 0

fix(push-subscriptions): Refactor how Sidekiq jobs are handled (#4226)

This commit is contained in:
Sorin Davidoi 2017-07-18 16:25:40 +02:00 committed by Eugen Rochko
parent afa52e4d63
commit 8387b3928e
3 changed files with 19 additions and 17 deletions

View file

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