Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit ee4304a

Browse files
committed
Fixing an issue where the Queue is loaded to full capacity and script blocks indefinitely
1 parent a602003 commit ee4304a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/rules/src/https_everywhere_checker/check_rules.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ def __init__(self, taskQueue, metric, thresholdDistance, autoDisable, resQueue):
8383
threading.Thread.__init__(self)
8484

8585
def run(self):
86-
while not self.taskQueue.empty():
86+
while True:
8787
try:
8888
self.processTask(self.taskQueue.get())
8989
self.taskQueue.task_done()
9090
except Exception, e:
9191
logging.exception(e)
92+
if self.taskQueue.empty():
93+
break
9294

9395
def processTask(self, task):
9496
problems = []
@@ -408,6 +410,11 @@ def cli():
408410
testedUrlPairCount = 0
409411
config.getboolean("debug", "exit_after_dump")
410412

413+
for i in range(threadCount):
414+
t = UrlComparisonThread(taskQueue, metric, thresholdDistance, autoDisable, resQueue)
415+
t.setDaemon(True)
416+
t.start()
417+
411418
# set of main pages to test
412419
mainPages = set(urlList)
413420
# If list of URLs to test/scan was not defined, use the test URL extraction
@@ -426,11 +433,6 @@ def cli():
426433
task = ComparisonTask(testUrls, fetcherPlain, fetcher, ruleset)
427434
taskQueue.put(task)
428435

429-
for i in range(threadCount):
430-
t = UrlComparisonThread(taskQueue, metric, thresholdDistance, autoDisable, resQueue)
431-
t.setDaemon(True)
432-
t.start()
433-
434436
taskQueue.join()
435437
logging.info("Finished in %.2f seconds. Loaded rulesets: %d, URL pairs: %d.",
436438
time.time() - startTime, len(xmlFnames), testedUrlPairCount)

0 commit comments

Comments
 (0)