Permalink
Browse files

Cache survey JSON load to increase export speed

  • Loading branch information...
kochman committed Dec 8, 2017
1 parent ce726f1 commit 61f101f8a71ce7e82f51ff3e8d1b2f6dfecafa51
Showing with 2 additions and 1 deletion.
  1. +2 −1 app.py
View
3 app.py
@@ -15,6 +15,7 @@
import csv
import datetime
import functools
import hashlib
import io
import json
@@ -31,6 +32,7 @@ def get_pepper():
return None
@functools.lru_cache(maxsize=1)
def get_survey():
with open('survey.json', 'r') as f:
return json.load(f)
@@ -291,7 +293,6 @@ def generate():
@app.route('/export.xlsx')
@login_required
def export_xlsx():
# see if this user is in CC_SURVEY_ADMINS
if cas.username not in CC_SURVEY_ADMINS:
abort(403)

0 comments on commit 61f101f

Please sign in to comment.