From d9710a98b5cf6a105325a78ed36f4da2c33340a4 Mon Sep 17 00:00:00 2001 From: Goutte Date: Fri, 22 Sep 2017 15:52:33 +0200 Subject: [PATCH] Rename the cleanup API, as we're going to have a real cache clear. --- web/run.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/run.py b/web/run.py index 2c658cf..efa5313 100755 --- a/web/run.py +++ b/web/run.py @@ -804,15 +804,17 @@ def download_targets_netcdf(targets, params, started_at, stopped_at): # API ######################################################################### -@app.route("/cache/clear") -def cache_clear(): +@app.route("/cache/cleanup") +def cache_cleanup(): """ Removes all files from the cache that are older than roughly one month. """ a_month_ago = datetime.datetime.now() - datetime.timedelta(days=32) cache_dir = get_path('../cache') removed_files = remove_files_created_before(a_month_ago, cache_dir) - return "Cache cleared! Removed %d old file(s)." % len(removed_files) + count = len(removed_files) + return "Cache cleaned! Removed %d old file%s." \ + % (count, 's' if count != 1 else '') @app.route("/cache/warmup") -- libgit2 0.21.2