perf: cache rendered routes
This commit is contained in:
parent
21a6f86402
commit
d1326ba40b
1 changed files with 2 additions and 0 deletions
|
@ -46,11 +46,13 @@ def middleware():
|
||||||
attribution['current_year'] = year
|
attribution['current_year'] = year
|
||||||
|
|
||||||
@threads.route('/')
|
@threads.route('/')
|
||||||
|
@cache.cached(timeout=300)
|
||||||
async def home():
|
async def home():
|
||||||
statuses = await fetch_statuses()
|
statuses = await fetch_statuses()
|
||||||
return render_template('threads.html', threads=statuses, app=app, attribution=attribution, render_date=datetime.now())
|
return render_template('threads.html', threads=statuses, app=app, attribution=attribution, render_date=datetime.now())
|
||||||
|
|
||||||
@threads.route('/<path:id>')
|
@threads.route('/<path:id>')
|
||||||
|
@cache.cached(timeout=300)
|
||||||
def thread(id):
|
def thread(id):
|
||||||
if id in thread_ids:
|
if id in thread_ids:
|
||||||
status = fetch_thread(id)
|
status = fetch_thread(id)
|
||||||
|
|
Loading…
Reference in a new issue