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
8cda0015
Commit
8cda0015
authored
7 years ago
by
Matt Traudt
Committed by
Matt Traudt
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Block on HelperRelayList.next() until a helper is available
parent
c52a850b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sbws/lib/helperrelay.py
+13
-2
13 additions, 2 deletions
sbws/lib/helperrelay.py
with
13 additions
and
2 deletions
sbws/lib/helperrelay.py
+
13
−
2
View file @
8cda0015
...
...
@@ -7,6 +7,7 @@ from stem.descriptor.router_status_entry import RouterStatusEntryV3
from
threading
import
RLock
import
random
import
logging
import
time
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -150,8 +151,18 @@ class HelperRelayList:
pick a helper that has a relay with a fingerprint in the given
blacklist. Returns None if no valid helper is available.
'''
with
self
.
_reachability_lock
:
if
self
.
_should_perform_reachability_test
():
self
.
_perform_reachability_test
()
while
True
:
if
self
.
_should_perform_reachability_test
():
self
.
_perform_reachability_test
()
if
len
(
self
.
_usable_helpers
)
>
0
:
break
time_till_next_check
=
self
.
_reachability_test_every
+
0.001
log
.
warning
(
'
Of our %d configured helpers, none are usable at
'
'
this time. Sleeping %f seconds on this blocking
'
'
call to HelperRelayList.next() until we can
'
'
check for a usable helper again.
'
,
len
(
self
.
_all_helpers
),
time_till_next_check
)
time
.
sleep
(
time_till_next_check
)
assert
not
self
.
_should_perform_reachability_test
()
random
.
shuffle
(
self
.
_usable_helpers
)
for
helper
in
self
.
_usable_helpers
:
...
...
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