From 15e57dca906f20ed704a55812bf7368381a64783 Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Fri, 25 Oct 2019 07:00:29 +0200 Subject: [PATCH] Naming things and invalidating the cache. --- flaskr/controllers/main_controller.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+), 0 deletions(-) diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index 54b3012..2ef900c 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -57,6 +57,20 @@ def estimate(): return render_template("estimate.html", form=form) +@main.route("/invalidate") +def invalidate(): + stuck_estimations = Estimation.query \ + .filter_by(status=StatusEnum.working) \ + .all() + + for estimation in stuck_estimations: + estimation.status = StatusEnum.failure + estimation.errors = "Invalidated. Try again." + db.session.commit() + + return "" + + @main.route("/compute") def compute(): # process the queue of estimation requests @@ -298,6 +312,7 @@ def compute(): # process the queue of estimation requests use_train_below=0, ) city_results['city'] = city_key + city_results['address'] = destination.address results['cities'].append(city_results) # Todo: sort cities, and perhaps extract optimum -- libgit2 0.21.2