From 1bbf6315453844ac43a8a2c8c38aee79a5a152e5 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Tue, 16 Apr 2019 15:50:06 +0000 Subject: [PATCH] Handle all exceptions loading pickled data The pickle file is just a local cache of Gerrit data. If we fail to load it, it will just be regenerated from Gerrit. We should never allow a failure in pickle.load to be fatal. Change-Id: If433fa5f335db8db63cdd264919c0dbeb3a7a32e --- reviewstats/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reviewstats/utils.py b/reviewstats/utils.py index 81d591b..84890cc 100644 --- a/reviewstats/utils.py +++ b/reviewstats/utils.py @@ -147,7 +147,9 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='', with open(pickle_fn, 'r') as f: try: changes = pickle.load(f) - except MemoryError: + except Exception: + logging.warning('Failed to load cached data from %s', + pickle_fn) changes = {} if not isinstance(changes, dict):