Skip to content

Commit

Permalink
Fix #26.
Browse files Browse the repository at this point in the history
  • Loading branch information
Schpidi committed Apr 3, 2019
1 parent 3e35090 commit c0658ac
Showing 1 changed file with 36 additions and 19 deletions.
55 changes: 36 additions & 19 deletions ngeo_browse_server/control/management/commands/ngeo_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,42 @@ def _handle(self, start, end, browse_layer_id, browse_type):
logger.warning("Optimized browse image to be deleted not found"
" in path: %s" % file_path)

for minx, miny, maxx, maxy, start_time, end_time in seed_areas:
try:

# seed MapCache synchronously
# TODO: maybe replace this with an async solution
seed_mapcache(tileset=browse_layer_model.id,
grid=browse_layer_model.grid,
minx=minx, miny=miny,
maxx=maxx, maxy=maxy,
minzoom=browse_layer_model.lowest_map_level,
maxzoom=browse_layer_model.highest_map_level,
start_time=start_time,
end_time=end_time,
delete=False,
**get_mapcache_seed_config())
logger.info("Successfully finished seeding.")

except Exception, e:
logger.warn("Seeding failed: %s" % str(e))
# only if either start or end is present browses are left
if start or end:
if start:
if end:
seed_areas = [
area for area in seed_areas
if not (area[4] >= start and area[5] <= end)
]
else:
seed_areas = [
area for area in seed_areas if not (area[4] >= start)
]
else:
seed_areas = [
area for area in seed_areas if not (area[5] <= end)
]

for minx, miny, maxx, maxy, start_time, end_time in seed_areas:
try:

# seed MapCache synchronously
# TODO: maybe replace this with an async solution
seed_mapcache(tileset=browse_layer_model.id,
grid=browse_layer_model.grid,
minx=minx, miny=miny,
maxx=maxx, maxy=maxy,
minzoom=browse_layer_model.lowest_map_level,
maxzoom=browse_layer_model.highest_map_level,
start_time=start_time,
end_time=end_time,
delete=False,
**get_mapcache_seed_config())
logger.info("Successfully finished seeding.")

except Exception, e:
logger.warn("Seeding failed: %s" % str(e))

# TODO:
# - think about what to do with brows report
Expand Down

0 comments on commit c0658ac

Please sign in to comment.