Skip to content

Commit

Permalink
Merge branch 'refresh_while_serving' into stale_error_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mki-c2c committed Jul 26, 2021
2 parents 140ae0a + 20db92c commit 82ed045
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions mapproxy/cache/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,27 +378,27 @@ def _create_single_tile(self, tile):
if not self.is_cached(tile):
try:
source = self._query_sources(query)
if not source: return []
if source.authorize_stale and self.is_stale(tile):
# The configuration authorises blank tiles generated by the error_handler
# to be replaced by stale tiles from cache.
self.cache.load_tile(tile)
return [tile]
if self.tile_mgr.image_opts != source.image_opts:
# call as_buffer to force conversion into cache format
source.as_buffer(self.tile_mgr.image_opts)
source.image_opts = self.tile_mgr.image_opts
tile.source = source
tile.cacheable = source.cacheable
tile = self.tile_mgr.apply_tile_filter(tile)
if source.cacheable:
self.cache.store_tile(tile)
# if source is not available, try to serve tile in cache
except SourceError as e:
if self.is_stale(tile):
self.cache.load_tile(tile)
else:
reraise_exception(e, sys.exc_info())
if not source: return []
if source.authorize_stale and self.is_stale(tile):
# The configuration authorises blank tiles generated by the error_handler
# to be replaced by stale tiles from cache.
self.cache.load_tile(tile)
return [tile]
if self.tile_mgr.image_opts != source.image_opts:
# call as_buffer to force conversion into cache format
source.as_buffer(self.tile_mgr.image_opts)
source.image_opts = self.tile_mgr.image_opts
tile.source = source
tile.cacheable = source.cacheable
tile = self.tile_mgr.apply_tile_filter(tile)
if source.cacheable:
self.cache.store_tile(tile)
else:
self.cache.load_tile(tile)
return [tile]
Expand Down

0 comments on commit 82ed045

Please sign in to comment.