[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Recover code lost on merge bug28932



commit b9bc234e72838f610285e27977b82db27d80639f
Author: juga0 <juga@xxxxxxxxxx>
Date:   Mon Feb 18 15:06:00 2019 +0000

    Recover code lost on merge bug28932
    
    Merge: 8dbe89057d7eebd7f470fa28aed5d419a76df8cb.
    Coded introduced in a550d73178d6fc8158bb5ae518e719c0f81b8ae7 and
    5dae9b99d2cda373b5f05139faf1b7a8710fc5d8.
---
 sbws/core/scanner.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index 013d4ee..d3690a2 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -14,7 +14,7 @@ from ..lib.relayprioritizer import RelayPrioritizer
 from ..lib.destination import DestinationList
 from ..util.timestamp import now_isodt_str
 from ..util.state import State
-from sbws.globals import fail_hard, HTTP_GET_HEADERS
+from sbws.globals import fail_hard, HTTP_GET_HEADERS, TIMEOUT_MEASUREMENTS
 import sbws.util.stem as stem_utils
 import sbws.util.requests as requests_utils
 from argparse import ArgumentDefaultsHelpFormatter
@@ -456,12 +456,16 @@ def main_loop(args, conf, controller, relay_list, circuit_builder, result_dump,
                 # sleep is non-blocking since 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 since happens in the main process.
+        time_waiting = 0
+        while (len(pending_results) > 0
+               and time_waiting <= TIMEOUT_MEASUREMENTS):
+            log.debug("Number of pending measurement threads %s after "
+                      "a prioritization loop.", len(pending_results))
             time.sleep(time_to_sleep)
+            time_waiting += time_to_sleep
             pending_results = [r for r in pending_results if not r.ready()]
+        if time_waiting > TIMEOUT_MEASUREMENTS:
+            dumpstacks()
         loop_tstop = time.time()
         loop_tdelta = (loop_tstop - loop_tstart) / 60
         log.debug("Measured %s relays in %s minutes", num_relays, loop_tdelta)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits