Skip to content

Commit

Permalink
Don't automatically flush memcached tile cache on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Dec 18, 2023
1 parent f8e55ed commit c0faeb6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

### Changes
- Use an enum for priority constants ([#1400](../../pull/1400))
- Don't automatically flush memcached tile cache on exit ([#1409](../../pull/1409))

### Bug Fixes
- Fix an issue emitting geojson annotations ([#1395](../../pull/1395))
Expand Down
13 changes: 10 additions & 3 deletions large_image/cache_util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


@atexit.register
def cachesClear(*args, **kwargs):
def cachesClearExceptTile(*args, **kwargs):
"""
Clear the tilesource caches and the load model cache. Note that this does
not clear memcached (which could be done with tileCache._client.flush_all,
Expand All @@ -39,15 +39,22 @@ def cachesClear(*args, **kwargs):
for name in LruCacheMetaclass.namedCaches:
with LruCacheMetaclass.namedCaches[name][1]:
LruCacheMetaclass.namedCaches[name][0].clear()
for func in _cacheClearFuncs:
func()


def cachesClear(*args, **kwargs):
"""
Clear the tilesource caches, the load model cache, and the tile cache.
"""
cachesClearExceptTile()
if isTileCacheSetup():
tileCache, tileLock = getTileCache()
try:
with tileLock:
tileCache.clear()
except Exception:
pass
for func in _cacheClearFuncs:
func()


def cachesInfo(*args, **kwargs):
Expand Down
1 change: 0 additions & 1 deletion large_image/tilesource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,6 @@ def _outputTileNumpyStyle(self, tile, applyStyle, x, y, z, frame=None):
:returns: a numpy array and a target PIL image mode.
"""
tile, mode = _imageToNumpy(tile)
# if applyStyle and (getattr(self, 'style', None) or hasattr(self, '_iccprofiles')):
if (applyStyle and (getattr(self, 'style', None) or hasattr(self, '_iccprofiles')) and
(not getattr(self, 'style', None) or len(self.style) != 1 or
self.style.get('icc') is not False)):
Expand Down

0 comments on commit c0faeb6

Please sign in to comment.