diff --git a/fedn/network/loadbalancer/leastpacked.py b/fedn/network/loadbalancer/leastpacked.py index 786dd8de0..8e793e95a 100644 --- a/fedn/network/loadbalancer/leastpacked.py +++ b/fedn/network/loadbalancer/leastpacked.py @@ -16,18 +16,16 @@ def find_combiner(self): """Find the combiner with the least number of attached clients. """ - min_clients = None + min_clients = -1 selected_combiner = None - for combiner in self.network.get_combiners(): try: if combiner.allowing_clients(): # Using default default Channel = 1, MODEL_UPDATE_REQUESTS nr_active_clients = len(combiner.list_active_clients()) - if not min_clients or nr_active_clients < min_clients: + if min_clients == -1 or nr_active_clients < min_clients: min_clients = nr_active_clients selected_combiner = combiner except CombinerUnavailableError: pass - return selected_combiner