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()
|
images = request.getImages()
|
||||||
deleted_images = []
|
deleted_images = []
|
||||||
|
|
||||||
|
logging.info(f'Request to remove files from cache')
|
||||||
|
|
||||||
if not mount_cache():
|
if not mount_cache():
|
||||||
|
logging.error(f'Cache is not mounted')
|
||||||
return
|
return
|
||||||
|
|
||||||
img_dir = OG_CACHE_IMAGE_PATH
|
img_dir = OG_CACHE_IMAGE_PATH
|
||||||
|
|
||||||
if not os.path.isdir(img_dir):
|
if not os.path.isdir(img_dir):
|
||||||
|
logging.error(f'{img_dir} is not a directory')
|
||||||
return cache_contents
|
return cache_contents
|
||||||
|
|
||||||
for file_name in os.listdir(img_dir):
|
for file_name in os.listdir(img_dir):
|
||||||
|
|
@ -630,20 +634,22 @@ class OgLiveOperations:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if file_name in images:
|
if file_name in images:
|
||||||
|
logging.info(f'Removing file {file_path} from cache')
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
|
|
||||||
csum_path = file_path + '.full.sum'
|
csum_path = file_path + '.full.sum'
|
||||||
if not os.path.isfile(csum_path):
|
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
|
continue
|
||||||
|
|
||||||
|
logging.info(f'Removing checksum file {csum_path} from cache')
|
||||||
os.remove(csum_path)
|
os.remove(csum_path)
|
||||||
|
|
||||||
result = {'cache': self._get_cache_contents()}
|
result = {'cache': self._get_cache_contents()}
|
||||||
|
|
||||||
self._restartBrowser(self._url)
|
self._restartBrowser(self._url)
|
||||||
|
|
||||||
logging.info('Sending response to cache/delete request')
|
logging.info('Delete file from cache request OK')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def refresh(self, ogRest):
|
def refresh(self, ogRest):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue