From 55afc9a401d4768599c4ef578e9e663436a7302a Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 31 Dec 2020 09:36:55 +0000 Subject: [PATCH] Increase provider lookup cache TTL to 10 seconds Tested locally with TTL values of: - 2 seconds - 5 seconds - 10 seconds The benefit really started showing at 10 seconds, where >50% of lookups hit the cache rather than the database. For graphs see https://github.com/alphagov/notifications-api/pull/3075#issuecomment-750836404 --- app/delivery/send_to_providers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 1c780e801..71a8c8d02 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -148,7 +148,7 @@ def update_notification_to_sending(notification, provider): dao_update_notification(notification) -provider_cache = TTLCache(maxsize=8, ttl=2) +provider_cache = TTLCache(maxsize=8, ttl=10) @cached(cache=provider_cache)