Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbws
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
juga
sbws
Commits
96aadc69
Unverified
Commit
96aadc69
authored
4 years ago
by
Georg Koppen
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'gitlab/merge-requests/51' into maint-1.1
parents
38649f0f
a050110d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sbws/lib/relaylist.py
+5
-12
5 additions, 12 deletions
sbws/lib/relaylist.py
tests/unit/lib/test_relaylist.py
+4
-4
4 additions, 4 deletions
tests/unit/lib/test_relaylist.py
with
9 additions
and
16 deletions
sbws/lib/relaylist.py
+
5
−
12
View file @
96aadc69
...
...
@@ -14,7 +14,7 @@ from ..globals import (
MAX_RECENT_PRIORITY_LIST_COUNT
,
MEASUREMENTS_PERIOD
)
from
..util
import
timestamp
,
timestamps
from
..util
import
timestamps
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -251,12 +251,6 @@ class Relay:
def
relay_recent_priority_list_count
(
self
):
return
len
(
self
.
relay_recent_priority_list
)
def
is_old
(
self
):
"""
Whether the last consensus seen for this relay is older than the
measurement period.
"""
return
timestamp
.
is_old
(
self
.
last_consensus_timestamp
)
# XXX: tech-debt: replace `_desc` attr by a a `dequee` of the last
# descriptors seen for this relay and the timestamp.
def
update_server_descriptor
(
self
,
server_descriptor
):
...
...
@@ -418,11 +412,10 @@ class RelayList:
# already added to the new list.
new_relays_dict
.
pop
(
fp
)
# If the relay is not in the current consensus but is not "old"
# yet, add it to the new list of relays too, though its timestamp,
# router status and descriptor can't be updated.
elif
not
r
.
is_old
():
new_relays
.
append
(
r
)
# In #30727, the relay that is not in the current conensus but is
# not "old", was added to the new list of relays too.
# In #40037 we think it should not be measured, as it might cause
# many circuit errors. It's already added to the generator.
# Otherwise, don't add it to the new list of relays.
# For debugging, count the old relays that will be discarded.
else
:
...
...
This diff is collapsed.
Click to expand it.
tests/unit/lib/test_relaylist.py
+
4
−
4
View file @
96aadc69
...
...
@@ -51,7 +51,7 @@ def test_init_relays(
assert
6505
==
6433
+
len
(
added_fps
)
# The calculated min bw for the second hop
assert
2120000
==
relay_list
.
_exit_min_bw
assert
2
0
0000
==
relay_list
.
_non_exit_min_bw
assert
2
1
0000
==
relay_list
.
_non_exit_min_bw
# Five days later plus 1 second.
# The first consensus timestamp will get removed.
...
...
@@ -69,10 +69,10 @@ def test_init_relays(
removed_fps
=
fps
.
difference
(
fps_5days_later
)
# The number of relays will be the number of relays in the cosensus plus
# the added ones minus the removed ones.
assert
6
925
==
6505
+
len
(
added_fps
)
-
len
(
removed_fps
)
assert
6
596
==
6505
+
len
(
added_fps
)
-
len
(
removed_fps
)
# The calculated min bw for the second hop
assert
2
79
0000
==
relay_list
.
_exit_min_bw
assert
1
1
0000
==
relay_list
.
_non_exit_min_bw
assert
2
80
0000
==
relay_list
.
_exit_min_bw
assert
1
5
0000
==
relay_list
.
_non_exit_min_bw
def
test_increment_recent_measurement_attempt
(
args
,
conf
,
controller
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment