mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Merge pull request #897 from alphagov/fix-slow-delete
remove slow join from template-last-use query
This commit is contained in:
@@ -124,10 +124,10 @@ def dao_get_template_usage(service_id, limit_days=None):
|
|||||||
def dao_get_last_template_usage(template_id):
|
def dao_get_last_template_usage(template_id):
|
||||||
return NotificationHistory.query.filter(
|
return NotificationHistory.query.filter(
|
||||||
NotificationHistory.template_id == template_id,
|
NotificationHistory.template_id == template_id,
|
||||||
NotificationHistory.key_type != KEY_TYPE_TEST) \
|
NotificationHistory.key_type != KEY_TYPE_TEST
|
||||||
.join(Template) \
|
).order_by(
|
||||||
.order_by(desc(NotificationHistory.created_at)) \
|
desc(NotificationHistory.created_at)
|
||||||
.first()
|
).first()
|
||||||
|
|
||||||
|
|
||||||
@statsd(namespace="dao")
|
@statsd(namespace="dao")
|
||||||
|
|||||||
Reference in New Issue
Block a user