From 7a406d44176d9a74bdfaf9a4a8eecf06771a0ddb Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Thu, 23 Apr 2020 11:37:45 -0400 Subject: [PATCH] Cache site config per-request to reduce DB queries from template render (#23791) ARCHBOM-1139: We were seeing about 150 queries to the django_site table and over 200 to memcached just to load the login page. A lot of these are via mako template rendering, but there are other sources, and this will hopefully nip it in the bud. --- openedx/core/djangoapps/site_configuration/helpers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openedx/core/djangoapps/site_configuration/helpers.py b/openedx/core/djangoapps/site_configuration/helpers.py index 45663497f3..9873a871b7 100644 --- a/openedx/core/djangoapps/site_configuration/helpers.py +++ b/openedx/core/djangoapps/site_configuration/helpers.py @@ -4,8 +4,10 @@ Helpers methods for site configuration. from django.conf import settings +from openedx.core.lib.cache_utils import request_cached +@request_cached("site_config") def get_current_site_configuration(): """ Return configuration for the current site.