From 2adaaac3aec2a83c5c5e87e97d0aa5324baae373 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Mon, 13 Dec 2021 17:00:41 +0000 Subject: [PATCH] Remove redundant conditions for update query Filtering by ID is enough, noting the other conditions were the same between both queries. --- app/dao/notifications_dao.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index 58d7dff47..da75f285a 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -505,9 +505,6 @@ def dao_timeout_notifications(cutoff_time, limit=100000): ).limit(limit).all() Notification.query.filter( - Notification.created_at < cutoff_time, - Notification.status.in_(current_statuses), - Notification.notification_type.in_([SMS_TYPE, EMAIL_TYPE]), Notification.id.in_([n.id for n in notifications]), ).update( {'status': new_status, 'updated_at': updated_at},