mirror of https://git.48k.eu/ogclient
live: improve logging for file removal from cache
Provide a bit more logging to make it easier to debug issues.master
parent
fcfa5f9fbc
commit
59fa3bb120
|
@ -610,12 +610,16 @@ class OgLiveOperations:
|
|||
images = request.getImages()
|
||||
deleted_images = []
|
||||
|
||||
logging.info(f'Request to remove files from cache')
|
||||
|
||||
if not mount_cache():
|
||||
logging.error(f'Cache is not mounted')
|
||||
return
|
||||
|
||||
img_dir = OG_CACHE_IMAGE_PATH
|
||||
|
||||
if not os.path.isdir(img_dir):
|
||||
logging.error(f'{img_dir} is not a directory')
|
||||
return cache_contents
|
||||
|
||||
for file_name in os.listdir(img_dir):
|
||||
|
@ -630,20 +634,22 @@ class OgLiveOperations:
|
|||
continue
|
||||
|
||||
if file_name in images:
|
||||
logging.info(f'Removing file {file_path} from cache')
|
||||
os.remove(file_path)
|
||||
|
||||
csum_path = file_path + '.full.sum'
|
||||
if not os.path.isfile(csum_path):
|
||||
logging.info(f'Missing checksum file for {file_path}')
|
||||
logging.info(f'Missing checksum file {csum_path}')
|
||||
continue
|
||||
|
||||
logging.info(f'Removing checksum file {csum_path} from cache')
|
||||
os.remove(csum_path)
|
||||
|
||||
result = {'cache': self._get_cache_contents()}
|
||||
|
||||
self._restartBrowser(self._url)
|
||||
|
||||
logging.info('Sending response to cache/delete request')
|
||||
logging.info('Delete file from cache request OK')
|
||||
return result
|
||||
|
||||
def refresh(self, ogRest):
|
||||
|
|
Loading…
Reference in New Issue