Skip to contentSkip to conversation

cache: Optimise invalid cache file handling

PATCH New Richard Purdie 1 participant 1 message Jul 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cache: Optimise invalid cache file handling

If there is a corrupt/invalid cache file, we'd keep trying to reopen it. This is pointless, simplify the code paths and delete the dead file.

bitbake/lib/bb/cache.py +3 -1
index 6dedd4d..c7f3b7a 100644
@@ -823,9 +823,11 @@ class MultiProcessCache(object):
                     p = pickle.Unpickler(fd)
                     extradata, version = p.load()
             except (IOError, EOFError):
-                extradata, version = self.create_cachedata(), None
+                os.unlink(f)
+                continue
 
             if version != self.__class__.CACHE_VERSION:
+                os.unlink(f)
                 continue
 
             self.merge_data(extradata, data)