Improve a query in WebPushNotificationWorker (#4234)

This commit is contained in:
Akihiko Odaki 2017-07-17 18:03:48 +09:00 committed by Eugen Rochko
parent 68941d4dfa
commit 7f35947d8e

View File

@ -9,7 +9,7 @@ class WebPushNotificationWorker
recipient = Account.find(recipient_id)
notification = Notification.find(notification_id)
sessions_with_subscriptions = recipient.user.session_activations.reject { |session| session.web_push_subscription.nil? }
sessions_with_subscriptions = recipient.user.session_activations.where.not(web_push_subscription: nil)
sessions_with_subscriptions.each do |session|
begin