From 5e5403287ef8a194737d63b4a9d983050d742f00 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 28 Jun 2023 01:33:12 +0200 Subject: [PATCH] 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. --- platypush/plugins/inspect/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platypush/plugins/inspect/__init__.py b/platypush/plugins/inspect/__init__.py index 025b3be7f4..01bb6cfdb2 100644 --- a/platypush/plugins/inspect/__init__.py +++ b/platypush/plugins/inspect/__init__.py @@ -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): """