Setting Kiwix restart flag when service can't be restarted.

This commit is contained in:
Roland 2023-07-11 17:10:43 -06:00
parent e1920d1c0b
commit 6f94dac2e8
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 6 additions and 12 deletions

View file

@ -87,8 +87,6 @@ class KiwixZimDownloader(Downloader):
# Notify the maintainer if outdated Zim files are lying around.
lib.flag_outdated_zim_files()
# Notify the maintainer to restart Kiwix container.
lib.flag_kiwix_restart()
output_size = output_path.stat().st_size
if download_info.size and output_size != download_info.size:

View file

@ -461,7 +461,7 @@ async def remove_outdated_zim_files(path: pathlib.Path = None):
else:
background_task(refresh_files(outdated))
flag_kiwix_restart()
await restart_kiwix()
@register_refresh_cleanup
@ -476,17 +476,13 @@ def flag_outdated_zim_files():
flags.outdated_zims.clear()
def flag_kiwix_restart():
"""Set `kiwix_restart` Flag only if running in Docker."""
if DOCKERIZED:
flags.kiwix_restart.set()
else:
logger.debug(f'Not setting kiwix_restart flag because this is not Dockerized')
async def restart_kiwix():
if DOCKERIZED:
logger.warning('Unable to restart Kiwix serve because it is in a docker container')
logger.warning('Setting Kiwix restart because this is in a docker container')
flags.kiwix_restart.set()
return
if PYTEST:
logger.warning('Unable to restart Kiwix serve because we are testing')
return
logger.info('Restarting Kiwix serve')