-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce static file look up for ProductionS3Storage backend #907
Conversation
@@ -32,7 +33,8 @@ | |||
|
|||
<%def name='url(file, raw=False)'><% | |||
try: | |||
url = staticfiles_storage.url(file) | |||
with beeline.tracer(name='static_content.html.url'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debugging static files lookup.
@@ -149,6 +150,7 @@ def marketing_link_context_processor(request): | |||
) | |||
|
|||
|
|||
@beeline.traced(name='common.djangoapps.edxmako.shortcuts.render_to_string') | |||
def render_to_string(template_name, dictionary, namespace='main', request=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debugs rendering templates, which includes all/most calls to static files lookups.
f05af7a
to
f1c6cc1
Compare
86eda1c
to
f706cbb
Compare
…ry deploy and use the random prefix Related to appsembler/configuration#348
this mostly to debug slowness in static files look up as reported in RED-1961.
settings.CACHES['staticfiles'] wasn't getting hit when ProductionS3Storage is used in HTTP request context. This change enforces cache by overriding the ProductionS3Storage.url method.
c8a1fe9
to
9e1e8d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of getting this out quickly to unblock Juniper.
Longer term, we probably want to consider some things:
- instead of adding our stuff directly to
openedx.core.storage.ProductionS3Storage
, we probably ought to make our own storage class that just subclasses it to overrideurl()
and add the explicit caching, then useAppsemblerProductionS3Storage
in our config. - having honeycomb tracing on every call to
url()
is useful at the moment for debugging/verifying this fix, but is probably more verbose than we're going to want to dial it down later. - instead of commenting out the setting of the key prefix here and putting a random value in the config in Increase edxapp staticfiles cache timeout to 30 days to improve performance configuration#361 maybe we could instead set
EDX_PLATFORM_REVISION
to a git hash or cloud build revision id during the deploy (with something like an ansible--extra-vars=EDX_PLATFORM_REVISION=$REVISION_ID
in the deploy script. That would achieve the same effect of making sure that the cache is cleared on each deploy.
RED-1961.
CACHES['staticfiles']['KEY_PREFIX'] = EDX_PLATFORM_REVISION
by upstream which assumes we're deploying via git tags. We don't, we deploy frommain
and the upstream override keeps the cache stale and invalid.ProductionS3Storage.url
look up results manually.Tests