perf: cache rendered routes

This commit is contained in:
Ayo Ayco 2024-05-26 15:41:24 +02:00
parent 21a6f86402
commit d1326ba40b

View file

@ -46,11 +46,13 @@ def middleware():
attribution['current_year'] = year
@threads.route('/')
@cache.cached(timeout=300)
async def home():
statuses = await fetch_statuses()
return render_template('threads.html', threads=statuses, app=app, attribution=attribution, render_date=datetime.now())
@threads.route('/<path:id>')
@cache.cached(timeout=300)
def thread(id):
if id in thread_ids:
status = fetch_thread(id)