From 969a82cdfdf518af5958828846d7224eca65acf1 Mon Sep 17 00:00:00 2001
From: zphrs <z@zephiris.dev>
Date: Sat, 15 Mar 2025 14:19:04 -0700
Subject: [PATCH] added REBROADCAST_VIEW env detection

---
 utils/containers.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/utils/containers.py b/utils/containers.py
index 25d4c53..e2de7c4 100644
--- a/utils/containers.py
+++ b/utils/containers.py
@@ -13,6 +13,7 @@ import requests
 from .util import run_cmd_bg, Logger
 
 CONTAINER_ENGINE = os.getenv("ENGINE", "docker")
+REBROADCAST_VIEW = os.getenv("REBROADCAST_VIEW", None)
 
 
 class ContainerBuilder:
@@ -509,13 +510,17 @@ class ClusterConductor:
                     f"Warning: Node {i} IP addr changed from {node.ip} to {container_ip}"
                 )
                 node.ip = container_ip
-                if CONTAINER_ENGINE == "podman":
+                if CONTAINER_ENGINE == "podman" or REBROADCAST_VIEW is not None:
                     if hasattr(self, "_parent"):
                         self._parent.clients[
                             node.index
                         ].base_url = self.node_external_endpoint(node.index)
                     view_changed = True
-        if CONTAINER_ENGINE == "podman" and view_changed and hasattr(self, "_parent"):
+        if (
+            (CONTAINER_ENGINE == "podman" or REBROADCAST_VIEW is not None)
+            and view_changed
+            and hasattr(self, "_parent")
+        ):
             self._parent.rebroadcast_view(self.get_shard_view())
 
     DeprecationWarning("View is in updated format")
-- 
GitLab