From 2f31dc7aab7c5d69a1d81b95e99e1fec34f961e7 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 19 Sep 2017 13:22:33 -0400 Subject: [PATCH] cache_shelve: wrap deletions in try..except in purge_outdated Hopefully solves #402 and #439. --- core/pe/cache_shelve.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/pe/cache_shelve.py b/core/pe/cache_shelve.py index cc4a39c0..fee51dad 100644 --- a/core/pe/cache_shelve.py +++ b/core/pe/cache_shelve.py @@ -126,6 +126,11 @@ class ShelveCache: continue todelete.append(path) for path in todelete: - del self[path] - + try: + del self[path] + except KeyError: + # I have no idea why a KeyError sometimes happen, but it does, as we can see in + # #402 and #439. I don't think it hurts to silently ignore the error, so that's + # what we do + pass