[tor-commits] [sbws/master] fix: relaylist: Use is_old fn removing consensus

juga at torproject.org juga at torproject.org
Mon Mar 9 18:01:37 UTC 2020


commit 2763a868b88ef02f28f8d2056f12c9a67e54ecd7
Author: juga0 <juga at riseup.net>
Date:   Sun Mar 8 10:36:30 2020 +0000

    fix: relaylist: Use is_old fn removing consensus
    
    since the logic is the same and the there were two bugfixes on the
    same logic.
---
 sbws/lib/relaylist.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index 722896e..aaec6ea 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -24,9 +24,11 @@ def remove_old_consensus_timestamps(
     :param int measurements_period:
     :returns list: a new list of ``consensus_timestamps``
     """
-    oldest_date = datetime.utcnow() - timedelta(seconds=measurements_period)
-    new_consensus_timestamps = \
-        [t for t in consensus_timestamps if t >= oldest_date]
+    new_consensus_timestamps = [
+        t
+        for t in consensus_timestamps
+        if not timestamp.is_old(t, measurements_period)
+    ]
     return new_consensus_timestamps
 
 





More information about the tor-commits mailing list