diff options
| author | Jan Friedli | 2020-05-15 14:38:13 +0200 |
|---|---|---|
| committer | Jan Friedli | 2020-05-15 14:38:13 +0200 |
| commit | 83618ff529dbd8e8b89a51e54a7d81eab7dd823b (patch) | |
| tree | b5b88ec536a2e3928cc74038422935fe3abb3680 /matweb/file_removal_scheduler.py | |
| parent | e75d9a7de5a083d983d0d682a48752f48df71eb2 (diff) | |
added new property which indicates the remaining download time in secs
Diffstat (limited to 'matweb/file_removal_scheduler.py')
| -rw-r--r-- | matweb/file_removal_scheduler.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/matweb/file_removal_scheduler.py b/matweb/file_removal_scheduler.py index 2ce7912..59bb9ca 100644 --- a/matweb/file_removal_scheduler.py +++ b/matweb/file_removal_scheduler.py | |||
| @@ -4,6 +4,8 @@ import sys | |||
| 4 | import os | 4 | import os |
| 5 | import random | 5 | import random |
| 6 | 6 | ||
| 7 | from matweb import utils | ||
| 8 | |||
| 7 | 9 | ||
| 8 | def run_file_removal_job(upload_folder_path): | 10 | def run_file_removal_job(upload_folder_path): |
| 9 | if random.randint(0, 10) == 0: | 11 | if random.randint(0, 10) == 0: |
| @@ -18,7 +20,7 @@ def delete_file_when_too_old(filepath): | |||
| 18 | last_time = time.time() - file_mod_time | 20 | last_time = time.time() - file_mod_time |
| 19 | 21 | ||
| 20 | # if file is older than our configured max timeframe, delete it | 22 | # if file is older than our configured max timeframe, delete it |
| 21 | if last_time > int(os.environ.get('MAT2_MAX_FILE_AGE_FOR_REMOVAL', 15 * 60)): | 23 | if last_time > utils.get_file_removal_max_age_sec(): |
| 22 | try: | 24 | try: |
| 23 | os.remove(filepath) | 25 | os.remove(filepath) |
| 24 | except OSError: | 26 | except OSError: |
