From b6eab617cc46871ad9864c32237c34ace57bf35e Mon Sep 17 00:00:00 2001 From: David Manthey Date: Tue, 27 Jun 2023 09:06:47 -0400 Subject: [PATCH] Increase the cache used for opening directories in the pylibtiff source --- CHANGELOG.md | 4 ++++ large_image/cache_util/memcache.py | 4 ++-- sources/tiff/large_image_source_tiff/__init__.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eb85967a..4be368750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Improvements - Harden reading some nc files ([#1218](../../pull/1218)) +- Increase the cache used for opening directories in the pylibtiff source ([#1221](../../pull/1221)) + +### Bug Fixes +- Pass style to histogram endpoint as json ([#1220](../../pull/1220)) ## 1.23.0 diff --git a/large_image/cache_util/memcache.py b/large_image/cache_util/memcache.py index cc66de94f..7efdd493a 100644 --- a/large_image/cache_util/memcache.py +++ b/large_image/cache_util/memcache.py @@ -104,8 +104,8 @@ def __setitem__(self, key, value): valueRepr = valueRepr[:500] + '...' self.logError( exc.__class__, config.getConfig('logprint').error, - '%s: Failed to save value %s (size %r) with key %s' % ( - exc.__class__.__name__, valueRepr, valueSize, hashedKey)) + '%s: Failed to save value (size %r) with key %s' % ( + exc.__class__.__name__, valueSize, hashedKey)) except pylibmc.ServerDown: self.logError(pylibmc.ServerDown, config.getConfig('logprint').info, 'Memcached ServerDown') diff --git a/sources/tiff/large_image_source_tiff/__init__.py b/sources/tiff/large_image_source_tiff/__init__.py index 1551ff709..66ac3d425 100644 --- a/sources/tiff/large_image_source_tiff/__init__.py +++ b/sources/tiff/large_image_source_tiff/__init__.py @@ -648,7 +648,8 @@ def getTile(self, x, y, z, pilImageAllowed=False, numpyAllowed=False, def _getDirFromCache(self, dirnum, subdir=None): if not hasattr(self, '_directoryCache'): self._directoryCache = {} - self._directoryCacheMaxSize = max(20, self.levels * 3) + self._directoryCacheMaxSize = max(20, self.levels * (2 + ( + self.metadata.get('IndexRange', {}).get('IndexC', 1)))) key = (dirnum, subdir) result = self._directoryCache.get(key) if result is None: