diff --git a/CHANGELOG.md b/CHANGELOG.md index ac512a716..6c69c2b95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ ### Improvements - More untiled tiff files are handles by the bioformats reader (#569) +- Expose a concurrent option on endpoints for converting images (#583) + +### Changes +- Exceptions on cached items are no longer within the KeyError context (#584) ## Version 1.4.3 diff --git a/large_image/cache_util/cache.py b/large_image/cache_util/cache.py index 84d527faf..63ccc19a2 100644 --- a/large_image/cache_util/cache.py +++ b/large_image/cache_util/cache.py @@ -181,11 +181,15 @@ def __call__(cls, *args, **kwargs): # noqa - N805 key = cls.__name__ + ' ' + key with cacheLock: try: - instance = cache[key] + return cache[key] except KeyError: - instance = super().__call__(*args, **kwargs) - cache[key] = instance - instance._classkey = key + # By passing and handling the cache miss outside of the + # exception, any exceptions while trying to populate the cache + # will not be reported in the cache exception context. + pass + instance = super().__call__(*args, **kwargs) + cache[key] = instance + instance._classkey = key return instance