Don't fail when writing cache either

We handle errors loading the cache, but if we run out of memory while
writing the cache file it can also cause the run to fail unnecessarily.
If the cache is not written it just means data will have to be
retrieved from Gerrit.

Change-Id: I64ec3030000fc9d62fa8e55ba1524aeaf4f4095c
This commit is contained in:
Ben Nemec 2019-04-23 16:27:57 +00:00
parent 41422af648
commit ff938a9288
1 changed files with 5 additions and 1 deletions

View File

@ -240,7 +240,11 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
if not only_open and not stable:
with open(pickle_fn, 'w') as f:
pickle.dump(changes, f)
try:
pickle.dump(changes, f)
except Exception:
logging.warning('Failed to save cached data to %s',
pickle_fn)
all_changes.update(changes)