1- #!/usr/bin/env python
1+ #!/usr/bin/env python
22
33import binascii
44import collections
@@ -83,7 +83,7 @@ def __init__(self, taskQueue, metric, thresholdDistance, autoDisable, resQueue):
8383 threading .Thread .__init__ (self )
8484
8585 def run (self ):
86- while True :
86+ while not self . taskQueue . empty () :
8787 try :
8888 self .processTask (self .taskQueue .get ())
8989 self .taskQueue .task_done ()
@@ -408,11 +408,6 @@ def cli():
408408 testedUrlPairCount = 0
409409 config .getboolean ("debug" , "exit_after_dump" )
410410
411- for i in range (threadCount ):
412- t = UrlComparisonThread (taskQueue , metric , thresholdDistance , autoDisable , resQueue )
413- t .setDaemon (True )
414- t .start ()
415-
416411 # set of main pages to test
417412 mainPages = set (urlList )
418413 # If list of URLs to test/scan was not defined, use the test URL extraction
@@ -430,6 +425,12 @@ def cli():
430425 logging .debug ("Skipping excluded URL %s" , test .url )
431426 task = ComparisonTask (testUrls , fetcherPlain , fetcher , ruleset )
432427 taskQueue .put (task )
428+
429+ for i in range (threadCount ):
430+ t = UrlComparisonThread (taskQueue , metric , thresholdDistance , autoDisable , resQueue )
431+ t .setDaemon (True )
432+ t .start ()
433+
433434 taskQueue .join ()
434435 logging .info ("Finished in %.2f seconds. Loaded rulesets: %d, URL pairs: %d." ,
435436 time .time () - startTime , len (xmlFnames ), testedUrlPairCount )
0 commit comments