From 4fa29b025ea353a8cb55a2e81298c092297a3287 Mon Sep 17 00:00:00 2001 From: juga0 <juga@riseup.net> Date: Fri, 22 Mar 2019 09:17:42 +0000 Subject: [PATCH] fix: relayprioritizer: number of prioritized relays The number of prioritized relays was set to the minimum, but in a small testing network this could be lesser than the number of relays in the network. --- sbws/lib/relayprioritizer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbws/lib/relayprioritizer.py b/sbws/lib/relayprioritizer.py index bb64b06e..4932ea89 100644 --- a/sbws/lib/relayprioritizer.py +++ b/sbws/lib/relayprioritizer.py @@ -143,7 +143,9 @@ class RelayPrioritizer: # Increment the number of times ``best_priority`` has been run. self.increment_priority_lists() # Increment the number of relays that have been "prioritized". - self.increment_priority_relays(upper_limit) + # Because in a small testing network the upper limit could be smaller + # than the number of relays in the network, use the length of the list. + self.increment_priority_relays(len(relays[0:upper_limit])) for relay in relays[0:upper_limit]: log.debug('Returning next relay %s with priority %f', relay.nickname, relay.priority) -- GitLab