# HG changeset patch # User Goffi # Date 1583515143 -3600 # Node ID f14eb24328d076f286fe5f4949864f8383487cb8 # Parent 4f00fdf114451aa208db291a8db68905574a8099 core (memory/cache): purge cache metadata when the referenced file doesn't exist diff -r 4f00fdf11445 -r f14eb24328d0 sat/memory/cache.py --- a/sat/memory/cache.py Fri Mar 06 18:19:03 2020 +0100 +++ b/sat/memory/cache.py Fri Mar 06 18:19:03 2020 +0100 @@ -81,8 +81,15 @@ .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))