[tor-commits] [sbws/master] relayprioritizer: add comment about future refactor
juga at torproject.org
juga at torproject.org
Fri Feb 15 17:51:28 UTC 2019
commit 603f83adcaff021c8c5ba557a5e61d09c19ca79d
Author: juga0 <juga at riseup.net>
Date: Tue Dec 18 09:16:40 2018 +0000
relayprioritizer: add comment about future refactor
---
sbws/lib/relayprioritizer.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sbws/lib/relayprioritizer.py b/sbws/lib/relayprioritizer.py
index 13ed491..e920bd1 100644
--- a/sbws/lib/relayprioritizer.py
+++ b/sbws/lib/relayprioritizer.py
@@ -97,6 +97,7 @@ class RelayPrioritizer:
# or create constants.
freshness *= max(1.0-result.freshness_reduction_factor, 0)
priority += freshness
+ # In a future refactor, do not create a new attribute
relay.priority = priority
# Sort the relays by their priority, with the smallest (best) priority
# relays at the front
@@ -114,5 +115,7 @@ class RelayPrioritizer:
for relay in relays[0:upper_limit]:
log.debug('Returning next relay %s with priority %f',
relay.nickname, relay.priority)
+ # In a future refactor, a new attribute should not be created,
+ # then no need to remove it.
del(relay.priority)
yield relay
More information about the tor-commits
mailing list