Using clear_map_cache.sh script to handle clearing cache and restarting renderd after map import.

This commit is contained in:
Roland 2023-08-16 14:22:08 -06:00
parent a66fdb6b35
commit 1e0e72fa24
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
5 changed files with 20 additions and 9 deletions

View file

@ -216,19 +216,14 @@ def get_import_status(session: Session = None) -> List[MapFile]:
return map_paths
MOD_TILE_CACHE_DIR1 = Path('/var/lib/mod_tile/ajt')
MOD_TILE_CACHE_DIR2 = Path('/var/cache/renderd/tiles/ajt')
@wrol_mode_check
async def clear_mod_tile():
"""Remove all cached map tile files"""
"""Remove all cached map tile files.
@warning: Uses sudo to clear the files and restart the renderd service."""
if PYTEST:
return
logger.warning('Clearing map tile cache files')
if MOD_TILE_CACHE_DIR1.is_dir():
await asyncio.create_subprocess_shell(f'rm -r {MOD_TILE_CACHE_DIR1}')
if MOD_TILE_CACHE_DIR2.is_dir():
await asyncio.create_subprocess_shell(f'rm -r {MOD_TILE_CACHE_DIR2}')
await asyncio.create_subprocess_shell(f'sudo /opt/wrolpi/scripts/clear_map_cache.sh')