Commit d9710a98b5cf6a105325a78ed36f4da2c33340a4

Authored by Goutte
1 parent 601f9aa2

Rename the cleanup API, as we're going to have a real cache clear.

Showing 1 changed file with 5 additions and 3 deletions   Show diff stats
web/run.py
... ... @@ -804,15 +804,17 @@ def download_targets_netcdf(targets, params, started_at, stopped_at):
804 804  
805 805 # API #########################################################################
806 806  
807   -@app.route("/cache/clear")
808   -def cache_clear():
  807 +@app.route("/cache/cleanup")
  808 +def cache_cleanup():
809 809 """
810 810 Removes all files from the cache that are older than roughly one month.
811 811 """
812 812 a_month_ago = datetime.datetime.now() - datetime.timedelta(days=32)
813 813 cache_dir = get_path('../cache')
814 814 removed_files = remove_files_created_before(a_month_ago, cache_dir)
815   - return "Cache cleared! Removed %d old file(s)." % len(removed_files)
  815 + count = len(removed_files)
  816 + return "Cache cleaned! Removed %d old file%s." \
  817 + % (count, 's' if count != 1 else '')
816 818  
817 819  
818 820 @app.route("/cache/warmup")
... ...