commit 77832ace14276b7064e7da8099e4efad8a542145 Author: juga0 juga@riseup.net Date: Sun Mar 8 10:23:20 2020 +0000
fix: relaylist: Use seconds removing consensuses
by default days is passed to timedelta, what was making the oldest date be thousands of days in the past.
Bugfix 1.1.0. --- sbws/lib/relaylist.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py index 64a53d9..722896e 100644 --- a/sbws/lib/relaylist.py +++ b/sbws/lib/relaylist.py @@ -24,7 +24,7 @@ def remove_old_consensus_timestamps( :param int measurements_period: :returns list: a new list of ``consensus_timestamps`` """ - oldest_date = datetime.utcnow() - timedelta(measurements_period) + oldest_date = datetime.utcnow() - timedelta(seconds=measurements_period) new_consensus_timestamps = \ [t for t in consensus_timestamps if t >= oldest_date] return new_consensus_timestamps @@ -483,11 +483,12 @@ class RelayList: r = Relay(ns.fingerprint, c, ns=ns, timestamp=timestamp) new_relays.append(r)
+ days = self._measurements_period / (60 * 60 * 24) log.debug("Previous number of relays being measured %d", len(self._relays)) log.debug("Number of relays not in the in the consensus in the last " "%d days: %d.", - self._measurements_period, num_old_relays) + days, num_old_relays) log.debug("Number of relays to measure with the current consensus: " "%d", len(new_relays)) return new_relays
tor-commits@lists.torproject.org