Minor improvement

This commit is contained in:
Miroslav Stampar 2015-07-10 09:24:14 +02:00
parent 9ff115ce71
commit 4baaa4a5ad
2 changed files with 8 additions and 2 deletions

View File

@ -1015,11 +1015,15 @@ def checkStability():
like for instance string matching (--string).
"""
infoMsg = "testing if the target URL is stable. This can take a couple of seconds"
infoMsg = "testing if the target URL is stable. This can take up to a second"
logger.info(infoMsg)
firstPage = kb.originalPage # set inside checkConnection()
time.sleep(1)
delay = 1 - (time.time() - (kb.originalPageTime or 0))
delay = max(0, min(1, delay))
time.sleep(delay)
secondPage, _ = Request.queryPage(content=True, raise404=False)
if kb.redirectChoice:
@ -1306,6 +1310,7 @@ def checkConnection(suppressOutput=False):
try:
page, _ = Request.queryPage(content=True, noteResponseTime=False)
kb.originalPage = kb.pageTemplate = page
kb.originalPageTime = time.time()
kb.errorIsNone = False

View File

@ -1819,6 +1819,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.orderByColumns = None
kb.originalCode = None
kb.originalPage = None
kb.originalPageTime = None
kb.originalTimeDelay = None
kb.originalUrls = dict()