Skip to content
Snippets Groups Projects
Commit be1a68ef authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Return immediately on request to /update.

The processing takes longer than the timeout, do it in the background.
parent 3960b660
No related branches found
No related tags found
No related merge requests found
from concurrent.futures import ThreadPoolExecutor
from flask import Blueprint, current_app
from brian_dashboard_manager.routes import common
from brian_dashboard_manager.grafana.provision import provision
......@@ -13,5 +14,6 @@ def after_request(resp):
@routes.route('/', methods=['GET'])
def update():
success = provision(current_app.config[CONFIG_KEY])
return {'data': success}
executor = ThreadPoolExecutor(max_workers=1)
executor.submit(provision, current_app.config[CONFIG_KEY])
return {'data': {'message': 'Provisioning dashboards!'}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment