From 6c76502527bb1e809444d1733549691818a44fe1 Mon Sep 17 00:00:00 2001 From: David Roetzel Date: Thu, 1 Aug 2024 13:46:30 +0200 Subject: [PATCH] Speed up check of notification request validity. No need to load full account records here. --- app/models/notification_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/notification_request.rb b/app/models/notification_request.rb index 2f601ac36b..9fb782621d 100644 --- a/app/models/notification_request.rb +++ b/app/models/notification_request.rb @@ -47,6 +47,6 @@ class NotificationRequest < ApplicationRecord private def prepare_notifications_count - self.notifications_count = Notification.where(account: account, from_account: from_account, filtered: true).limit(MAX_MEANINGFUL_COUNT).count + self.notifications_count = Notification.where(account_id: account_id, from_account_id: from_account_id, filtered: true).limit(MAX_MEANINGFUL_COUNT).count end end