Remove redundant conditions for update query

Filtering by ID is enough, noting the other conditions were the
same between both queries.
This commit is contained in:
Ben Thorner
2021-12-13 17:00:41 +00:00
parent c8ebb365d4
commit 2adaaac3ae

View File

@@ -505,9 +505,6 @@ def dao_timeout_notifications(cutoff_time, limit=100000):
).limit(limit).all() ).limit(limit).all()
Notification.query.filter( 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]), Notification.id.in_([n.id for n in notifications]),
).update( ).update(
{'status': new_status, 'updated_at': updated_at}, {'status': new_status, 'updated_at': updated_at},