The inspect plugin should not fail hard if the cache couldn't be loaded.

This can happen for many reasons - not only if the cache file is not
accessible, but also if the structure/signature of some pickled objects
has changed. In that case, we should invalidate the current cache and
re-initialize it instead of failing.
This commit is contained in:
Fabio Manganiello 2023-06-28 01:33:12 +02:00
parent c5059f6908
commit 5e5403287e
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -57,8 +57,12 @@ class InspectPlugin(Plugin):
try: try:
with open(self._components_cache_file, 'rb') as f: with open(self._components_cache_file, 'rb') as f:
self._components_cache = pickle.load(f) self._components_cache = pickle.load(f)
except OSError: except Exception as e:
return self.logger.warning('Could not initialize the components cache: %s', e)
self.logger.info(
'The plugin will initialize the cache by scanning '
'the integrations at the next run. This may take a while'
)
def _flush_components_cache(self): def _flush_components_cache(self):
""" """