From 790e01866fbe2ba1778fa090064666c4ac01bb6e Mon Sep 17 00:00:00 2001 From: jpk Date: Wed, 15 Feb 2023 16:30:55 +0100 Subject: [PATCH] Reduce down time while updating --- doxy/cli.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doxy/cli.py b/doxy/cli.py index 9826e4e..fe293e4 100644 --- a/doxy/cli.py +++ b/doxy/cli.py @@ -89,12 +89,13 @@ def control(ctx, service, command): @only_if_service_exists def update(ctx, service, remove): compose_file = get_compose_file(Path(CONFIG.root_directory) / service) - command_chain = { - f"Stopping {service}": ["down" if remove else "stop"], - f"Pulling {service} images": ["pull"], - f"Starting {service}": ["up", "-d"], - } - for title, command in command_chain.items(): + command_chain = [ + (f"Pulling {service} images", ["pull"]), + (f"Starting {service}", ["up", "-d"]), + ] + if remove: + command_chain.insert(0, (f"Stopping {service}", ["down"])) + for title, command in command_chain: output.print_header(ctx, title) docker_compose_command(command, compose_file)