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
7dce78a8
Commit
7dce78a8
authored
6 years ago
by
juga
Browse files
Options
Downloads
Patches
Plain Diff
scanner: make the time to wait for threads a variable
that depends on the HTTP request timeout.
parent
c9ace7de
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/core/scanner.py
+7
-4
7 additions, 4 deletions
sbws/core/scanner.py
with
7 additions
and
4 deletions
sbws/core/scanner.py
+
7
−
4
View file @
7dce78a8
...
...
@@ -400,6 +400,9 @@ def main_loop(args, conf, controller, relay_list, circuit_builder, result_dump,
"""
pending_results
=
[]
# Set the time to wait for a thread to finish as the half of an HTTP
# request timeout.
time_to_sleep
=
conf
.
getfloat
(
'
general
'
,
'
http_timeout
'
)
/
2
# Do not start a new loop if sbws is stopping.
while
not
settings
.
end_event
.
is_set
():
log
.
debug
(
"
Starting a new measurement loop.
"
)
...
...
@@ -421,14 +424,14 @@ def main_loop(args, conf, controller, relay_list, circuit_builder, result_dump,
# Instead of letting apply_async to queue the relays in order until
# a thread has finished, wait here until a thread has finished.
while
len
(
pending_results
)
>=
max_pending_results
:
# sleep is non-blocking sine happens in the main process
time
.
sleep
(
5
)
# sleep is non-blocking sin
c
e happens in the main process
.
time
.
sleep
(
time_to_sleep
)
pending_results
=
[
r
for
r
in
pending_results
if
not
r
.
ready
()]
while
len
(
pending_results
)
>
0
:
log
.
debug
(
"
There are %s pending measurements.
"
,
len
(
pending_results
))
# sleep is non-blocking sine happens in the main process
time
.
sleep
(
5
)
# sleep is non-blocking sin
c
e happens in the main process
.
time
.
sleep
(
time_to_sleep
)
pending_results
=
[
r
for
r
in
pending_results
if
not
r
.
ready
()]
loop_tstop
=
time
.
time
()
loop_tdelta
=
(
loop_tstop
-
loop_tstart
)
/
60
...
...
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