GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 77832ace authored by juga  's avatar juga
Browse files

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.
parent 6c8fc408
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment