Skip to content

Commit

Permalink
Fixes bug in find_available if-statement (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhellander authored Jul 4, 2024
1 parent 153dd91 commit 6e75dfa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fedn/network/loadbalancer/leastpacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6e75dfa

Please sign in to comment.