[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 2763a868b88ef02f28f8d2056f12c9a67e54ecd7
Author: juga0 <juga@xxxxxxxxxx>
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
 
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits