Commit 39c5e42a authored by juga  's avatar juga
Browse files

Stop removing results that are not away

from some other X secs.
In #27338 it was implemented to do not include relays in the
bandwidth files that does not have at least 2 measurements that
are X secs away from each other.
It was implemented removing any results that were not X secs away
from each other, when all the results should be keep when there is
at least one away from the others, as commented in #28061.
parent c14cefd3
......@@ -5,6 +5,7 @@
import copy
import logging
import os
from itertools import combinations
from statistics import median, mean
from sbws import __version__
......@@ -332,17 +333,12 @@ class V3BWLine(object):
# "secs.", secs_away)
if secs_away is None or len(results) < 2:
return results
# the last one should be the most recent
results_away = [results[-1]]
# iterate over the rest of the results in reverse order
for r in reversed(results[:-1]):
if abs(results_away[0].time - r.time) > secs_away:
results_away.insert(0, r)
# if there is only 1 result, is the one inserted at the beginning,
# so there are no results away from each other
if len(results_away) < 2:
return None
return results_away
for a, b in combinations(results, 2):
if abs(a.time - b.time) > secs_away:
return results
# log.debug("Results are NOT away from each other in at least %ss: %s",
# secs_away, [unixts_to_isodt_str(r.time) for r in results])
return None
@staticmethod
def results_recent_than(results, secs_recent=None):
......
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