mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-24 08:04:44 +00:00
Tune timeout values to close threads faster on exit.
This commit is contained in:
parent
085eb6e77a
commit
f3c1458c9c
7 changed files with 13 additions and 10 deletions
|
|
@ -13,6 +13,8 @@ Changes:
|
|||
- install: Copy and execute the Microsoft Visual C runtime DLL
|
||||
installer. This solves startup error on WinXP systems that don't
|
||||
have this DLL installed.
|
||||
- checking: Tune timeout values to close threads faster on exit.
|
||||
Closes: SF bug #3087944
|
||||
|
||||
Features:
|
||||
- gui: Added "View parent URL online" context menu action to display
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ def check_url (aggregate):
|
|||
"""Helper function waiting for URL queue."""
|
||||
while True:
|
||||
try:
|
||||
aggregate.urlqueue.join(timeout=1)
|
||||
aggregate.urlqueue.join(timeout=0.5)
|
||||
break
|
||||
except urlqueue.Timeout:
|
||||
# Since urlqueue.join() is not interruptable, add a timeout
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class Aggregate (object):
|
|||
assert self.urlqueue.empty()
|
||||
for t in self.threads:
|
||||
t.stop()
|
||||
t.join(2)
|
||||
t.join(0.5)
|
||||
if t.isAlive():
|
||||
log.warn(LOG_CHECK, "Thread %s still active", t)
|
||||
self.connections.clear()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
"""
|
||||
URL checking functions.
|
||||
"""
|
||||
import time
|
||||
from . import task
|
||||
from ..cache import urlqueue
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ class Checker (task.CheckedTask):
|
|||
self.urlqueue.task_done(url_data)
|
||||
self.setName(self.origname)
|
||||
except urlqueue.Empty:
|
||||
time.sleep(0.1)
|
||||
pass
|
||||
|
||||
def check_url_data (self, url_data):
|
||||
"""Check one URL data instance."""
|
||||
|
|
|
|||
|
|
@ -31,11 +31,12 @@ class Cleanup (task.CheckedTask):
|
|||
"""Print periodic status messages."""
|
||||
self.start_time = time.time()
|
||||
self.setName("Cleanup")
|
||||
# clean every 15 seconds
|
||||
wait_seconds = 15
|
||||
waitfor = range(wait_seconds*10)
|
||||
while True:
|
||||
# clean every 30 seconds
|
||||
for dummy in range(30):
|
||||
time.sleep(1)
|
||||
# check every second if we have stopped
|
||||
for dummy in waitfor:
|
||||
time.sleep(0.1)
|
||||
if self.stopped():
|
||||
return
|
||||
self.connections.remove_expired()
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ class Status (task.CheckedTask):
|
|||
"""Print periodic status messages."""
|
||||
self.start_time = time.time()
|
||||
self.setName("Status")
|
||||
waitfor = range(self.wait_seconds)
|
||||
waitfor = range(self.wait_seconds*10)
|
||||
while True:
|
||||
for dummy in waitfor:
|
||||
time.sleep(1)
|
||||
time.sleep(0.1)
|
||||
if self.stopped():
|
||||
return
|
||||
self.log_status()
|
||||
|
|
|
|||
1
t.html
Normal file
1
t.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<html><head></head><body></body></html>
|
||||
Loading…
Reference in a new issue