From 904e55d76ce904038ce0e7261e3b802e8cc125e8 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Mon, 24 Feb 2014 14:58:59 -0500 Subject: [PATCH] Don't blow up on a MemoryError My VM that re-generates the stats is now breaking on a MemoryError when trying load the local cache. Ignore this for now since it will fall back to querying gerrit. Change-Id: I151fae89d9fb9a45d72e72c5aade4cb3342b4267 --- reviewstats/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reviewstats/utils.py b/reviewstats/utils.py index 0824d35..6099ca5 100644 --- a/reviewstats/utils.py +++ b/reviewstats/utils.py @@ -81,7 +81,10 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='', mtime = os.stat(pickle_fn).st_mtime if (time.time() - mtime) <= CACHE_AGE: with open(pickle_fn, 'r') as f: - changes = pickle.load(f) + try: + changes = pickle.load(f) + except MemoryError: + changes = None if not changes: while True: