@@ -83,12 +83,14 @@ def __init__(self, taskQueue, metric, thresholdDistance, autoDisable, resQueue):
83
83
threading .Thread .__init__ (self )
84
84
85
85
def run (self ):
86
- while not self . taskQueue . empty () :
86
+ while True :
87
87
try :
88
88
self .processTask (self .taskQueue .get ())
89
89
self .taskQueue .task_done ()
90
90
except Exception , e :
91
91
logging .exception (e )
92
+ if self .taskQueue .empty ():
93
+ break
92
94
93
95
def processTask (self , task ):
94
96
problems = []
@@ -408,6 +410,11 @@ def cli():
408
410
testedUrlPairCount = 0
409
411
config .getboolean ("debug" , "exit_after_dump" )
410
412
413
+ for i in range (threadCount ):
414
+ t = UrlComparisonThread (taskQueue , metric , thresholdDistance , autoDisable , resQueue )
415
+ t .setDaemon (True )
416
+ t .start ()
417
+
411
418
# set of main pages to test
412
419
mainPages = set (urlList )
413
420
# If list of URLs to test/scan was not defined, use the test URL extraction
@@ -426,11 +433,6 @@ def cli():
426
433
task = ComparisonTask (testUrls , fetcherPlain , fetcher , ruleset )
427
434
taskQueue .put (task )
428
435
429
- for i in range (threadCount ):
430
- t = UrlComparisonThread (taskQueue , metric , thresholdDistance , autoDisable , resQueue )
431
- t .setDaemon (True )
432
- t .start ()
433
-
434
436
taskQueue .join ()
435
437
logging .info ("Finished in %.2f seconds. Loaded rulesets: %d, URL pairs: %d." ,
436
438
time .time () - startTime , len (xmlFnames ), testedUrlPairCount )
0 commit comments