Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/SK-928 | Fixes bug in find_available if-statement #650

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading