diff options
author | Rhody Lugo <rhodylugo@gmail.com> | 2017-12-18 18:01:09 -0400 |
---|---|---|
committer | Rhody Lugo <rhodylugo@gmail.com> | 2017-12-18 22:17:38 -0400 |
commit | b40259096c70a4d05695bf2fd0eac9a395f17f93 (patch) | |
tree | 0dec489de2c9c83833a2876d96edbca4256525ea /SConstruct | |
parent | 83291eab3ae8940cc9da159774a1da6575196c89 (diff) |
sort by the most recently accessed files
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct index ad6b6ee445..88cd1494f1 100644 --- a/SConstruct +++ b/SConstruct @@ -557,9 +557,9 @@ class cache_progress: # decay since the ctime, and return a list with the entries # (filename, size, weight). current_time = time.time() - file_stat = [(x[0], x[1][0], x[1][0] * math.exp(self.exponent_scale * (x[1][1] - current_time))) for x in file_stat] - # Sort by highest weight (most sensible to keep) first - file_stat.sort(key=lambda x: x[2], reverse=True) + file_stat = [(x[0], x[1][0], (current_time - x[1][1])) for x in file_stat] + # Sort by the most resently accessed files (most sensible to keep) first + file_stat.sort(key=lambda x: x[2]) # Search for the first entry where the storage limit is # reached sum, mark = 0, None |