Fixed a bug in the caching of the agenda where too much was cached. Fixes issue #3008.

- Legacy-Id: 18109
This commit is contained in:
Henrik Levkowetz 2020-06-30 18:34:11 +00:00
parent 0924640676
commit 90b4783082
2 changed files with 9 additions and 18 deletions

View file

@ -904,12 +904,6 @@ def agenda(request, num=None, name=None, base=None, ext=None, owner=None, utc=""
else:
raise Http404("No such meeting")
if name == None and owner == None:
cache_key = ("meeting:%s:%s%s" % (meeting.number, base, ext))[:228]
rendered_page = caches['slowpages'].get(cache_key)
if rendered_page:
return rendered_page
if name is None:
schedule = get_schedule(meeting, name)
else:
@ -951,25 +945,18 @@ def agenda(request, num=None, name=None, base=None, ext=None, owner=None, utc=""
p.group_list.sort(key=lambda g: g.acronym)
is_current_meeting = bool(num == get_current_ietf_meeting_num())
rendered_page = render(request, "meeting/"+base+ext, {
"schedule": schedule,
"filtered_assignments": filtered_assignments,
"updated": updated,
"group_parents": group_parents,
"now": datetime.datetime.now(),
"is_current_meeting": bool(num == get_current_ietf_meeting_num()),
"is_current_meeting": is_current_meeting,
"use_codimd": True if meeting.date>=settings.MEETING_USES_CODIMD_DATE else False,
"cache_time": 150 if is_current_meeting else 3600,
}, content_type=mimetype[ext])
# If the agenda is for the current meeting, only cache for 2 minutes
if name == None and owner == None:
cache_key = ("meeting:%s:%s%s" % (meeting.number, base, ext))[:228]
if meeting.number == get_current_ietf_meeting_num():
timeout = 60 * 2
else:
timeout = 60 * 60 * 24
caches['slowpages'].set(cache_key, rendered_page, timeout)
return rendered_page
def agenda_csv(schedule, filtered_assignments):

View file

@ -44,13 +44,16 @@
</div>
<div class="row">
<div class="col-md-10">
{# cache this part -- it takes 3-6 seconds to generate #}
{% load cache %}
{% cache cache_time ietf_meeting_agenda_utc schedule.meeting.number request.path %}
<h1>Agenda</h1>
{% if is_current_meeting %}
{% if is_current_meeting %}
<p class="alert alert-info">
<b>Note:</b> IETF agendas are subject to change, up to and during a meeting.
</p>
{% endif %}
{% endif %}
{% if schedule.meeting.agenda_info_note %}
<p class="alert alert-info">
@ -351,6 +354,7 @@
</div>
</div>
{% endcache %}
{% endblock %}
{% block js %}