Skip to content

Commit

Permalink
don't override update delays if they are set to non 0 value
Browse files Browse the repository at this point in the history
  • Loading branch information
s4ke committed Feb 19, 2025
1 parent 3c67320 commit 0ab174a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docker/docker_swarm_enforcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,23 @@ def update_service(service):

print_timed(f"🔄 Updating {service_name}...")

if restart_delay == 0:
restart_delay = RESTART_DELAY

if update_delay == 0:
update_delay = UPDATE_DELAY

# Build the update command with existing config
update_params = {
"restart_policy": {
"Condition": service.attrs["Spec"]["TaskTemplate"].get("RestartPolicy", {}).get("Condition", "any"),
"Delay": RESTART_DELAY,
"Delay": restart_delay,
"MaxAttempts": service.attrs["Spec"]["TaskTemplate"].get("RestartPolicy", {}).get("MaxAttempts", 0),
"Window": service.attrs["Spec"]["TaskTemplate"].get("RestartPolicy", {}).get("Window", 10000000000),
},
"update_config": {
"Parallelism": service.attrs["Spec"].get("UpdateConfig", {}).get("Parallelism", 1),
"Delay": UPDATE_DELAY,
"Delay": update_delay,
"Order": service.attrs["Spec"].get("UpdateConfig", {}).get("Order", "stop-first"),
"FailureAction": service.attrs["Spec"].get("UpdateConfig", {}).get("FailureAction", "pause"),
"Monitor": service.attrs["Spec"].get("UpdateConfig", {}).get("Monitor", 5000000000),
Expand Down

0 comments on commit 0ab174a

Please sign in to comment.