Skip to content

Commit

Permalink
Make removal of non-existent cache span a no-op
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155413733
  • Loading branch information
tasnimsunny authored and ojw28 committed May 11, 2017
1 parent 1d6816d commit 51132f5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ private void addSpan(SimpleCacheSpan span) {

private void removeSpan(CacheSpan span, boolean removeEmptyCachedContent) throws CacheException {
CachedContent cachedContent = index.get(span.key);
Assertions.checkState(cachedContent.removeSpan(span));
if (cachedContent == null || !cachedContent.removeSpan(span)) {
return;
}
totalSpace -= span.length;
if (removeEmptyCachedContent && cachedContent.isEmpty()) {
index.removeEmpty(cachedContent.key);
Expand Down

0 comments on commit 51132f5

Please sign in to comment.