forked from platypush/platypush
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:
parent
c5059f6908
commit
5e5403287e
1 changed files with 6 additions and 2 deletions
|
@ -57,8 +57,12 @@ class InspectPlugin(Plugin):
|
|||
try:
|
||||
with open(self._components_cache_file, 'rb') as f:
|
||||
self._components_cache = pickle.load(f)
|
||||
except OSError:
|
||||
return
|
||||
except Exception as e:
|
||||
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):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue