Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
new: v3bwfile: Include relay consensus count
Browse files Browse the repository at this point in the history
Include a KeyValue in each bandwidth line with the number of
times the relay has been in a consensus in the past days.

Part of #28566.
  • Loading branch information
juga0 committed Mar 7, 2019
1 parent 634168f commit 26daa7f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sbws/lib/v3bwfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ def from_results(cls, results, secs_recent=None, secs_away=None,
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))
consensuses_count = [r.consensus_count for r in results
if getattr(r, 'consensus_count', None)]
if consensuses_count:
consensus_count = max(consensuses_count)
kwargs['relay_in_recent_consensus_count'] = consensus_count

success_results = [r for r in results if isinstance(r, ResultSuccess)]
if not success_results:
Expand Down

0 comments on commit 26daa7f

Please sign in to comment.