core (memory/cache): purge cache metadata when the referenced file doesn't exist
This commit is contained in:
parent
5e4e10e690
commit
4b69d89138
1 changed files with 9 additions and 2 deletions
|
|
@ -81,8 +81,15 @@ class Cache(object):
|
|||
.format(path=cache_file))
|
||||
continue
|
||||
|
||||
if eol < time.time():
|
||||
filepath = self.getPath(filename)
|
||||
filepath = self.getPath(filename)
|
||||
|
||||
if not filepath.exists():
|
||||
log.warning(_(
|
||||
"cache {cache_file!r} references an inexisting file: {filepath!r}"
|
||||
).format(cache_file=str(cache_file), filepath=str(filepath)))
|
||||
log.debug("purging cache with missing file")
|
||||
cache_file.unlink()
|
||||
elif eol < time.time():
|
||||
log.debug(
|
||||
"purging expired cache {filepath!r} (expired for {time}s)"
|
||||
.format(filepath=str(filepath), time=int(time.time() - eol))
|
||||
|
|
|
|||
Loading…
Reference in a new issue