Commit e7e960fd authored by juga's avatar juga
Browse files

chg: v3bwfile: !refactor, return on not successful results

when creating a Bandwidth Line from results

Part of #29591.
parent 1ad9292c
Loading
Loading
Loading
Loading
+37 −37
Original line number Diff line number Diff line
@@ -313,7 +313,6 @@ class V3BWLine(object):
        divided by the the time it took to received.
        bw = data (Bytes) / time (seconds)
        """
        success_results = [r for r in results if isinstance(r, ResultSuccess)]
        # log.debug("Len success_results %s", len(success_results))
        node_id = '$' + results[0].fingerprint
        kwargs = dict()
@@ -322,8 +321,10 @@ class V3BWLine(object):
            kwargs['master_key_ed25519'] = results[0].master_key_ed25519
        kwargs['time'] = cls.last_time_from_results(results)
        kwargs.update(cls.result_types_from_results(results))
        # useful args for scaling
        if success_results:

        success_results = [r for r in results if isinstance(r, ResultSuccess)]
        if not success_results:
            return None
        results_away = \
            cls.results_away_each_other(success_results, secs_away)
        if not results_away:
@@ -358,7 +359,6 @@ class V3BWLine(object):
            cls.desc_bw_obs_mean_from_results(results_recent)
        bwl = cls(node_id, bw, **kwargs)
        return bwl
        return None

    @classmethod
    def from_data(cls, data, fingerprint):