mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Setting Kiwix restart flag when service can't be restarted.
This commit is contained in:
parent
e1920d1c0b
commit
6f94dac2e8
2 changed files with 6 additions and 12 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue