Skip to content

Commit

Permalink
Use no-store instead of no-cache (force fetch instead of revalidate)
Browse files Browse the repository at this point in the history
Update 8e5a508.
  • Loading branch information
randomir committed Jun 9, 2021
1 parent 0376ddc commit 3ff6ad2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dwave/inspector/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,17 @@ def send_solver(problem_id):
@app.route('/api/callback/<problem_id>')
def notify_problem_loaded(problem_id):
app_server.notify_problem_accessed(problem_id)
resp = make_response(dict(ack=True))
resp.headers['Cache-Control'] = 'no-cache'
return resp
response = make_response(dict(ack=True))
response.cache_control.no_store = True
response.cache_control.max_age = 0 # force revalidation if already cached
return response

@app.after_request
def add_header(response):
# cache all responses for a day
response.cache_control.max_age = 86400
# cache responses for a day, unless caching turned off
if not response.cache_control.no_store:
response.cache_control.public = True
response.cache_control.max_age = 86400
return response

app_server = WSGIAsyncServer(host='127.0.0.1', base_port=18000, app=app)

0 comments on commit 3ff6ad2

Please sign in to comment.