Skip to content

Commit

Permalink
Catch KeyError exceptions raised in the LruAlgorithm.delete() method
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed Mar 5, 2016
1 parent 7df58f7 commit 4d74433
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions stash/algorithms/lru.py
Expand Up @@ -97,10 +97,13 @@ def delete(self, keys):
keys = [keys]

for key in keys:
node = self.nodes.pop(key)
try:
node = self.nodes.pop(key)

# Remove `node` from `queue`
self.queue.remove(node)
# Remove `node` from `queue`
self.queue.remove(node)
except KeyError:
pass

# Remove keys from `cache` and `archive`
return super(LruAlgorithm, self).delete(keys)
Expand Down

0 comments on commit 4d74433

Please sign in to comment.