mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-09 15:14:45 +00:00
since join() is not interruptable, put in a little sleep() call
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3191 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
ec2756021f
commit
61fc7ab502
1 changed files with 9 additions and 2 deletions
|
|
@ -17,6 +17,7 @@
|
|||
"""
|
||||
Management of checking a queue of links with several threads.
|
||||
"""
|
||||
import time
|
||||
import linkcheck
|
||||
import linkcheck.log
|
||||
import linkcheck.cache.urlqueue
|
||||
|
|
@ -37,8 +38,14 @@ def check_urls (aggregate):
|
|||
aggregate.logger.start_log_output()
|
||||
if not aggregate.urlqueue.empty():
|
||||
aggregate.start_threads()
|
||||
# blocks until all urls are checked
|
||||
aggregate.urlqueue.join()
|
||||
# Since urlqueue.join() is not interruptable, add a timeout
|
||||
# and a one-second slumber.
|
||||
while True:
|
||||
try:
|
||||
aggregate.urlqueue.join(timeout=1)
|
||||
break
|
||||
except linkcheck.cache.urlqueue.Timeout:
|
||||
time.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
linkcheck.log.warn(linkcheck.LOG_CHECK,
|
||||
"keyboard interrupt; waiting for active threads to finish")
|
||||
|
|
|
|||
Loading…
Reference in a new issue