reset after 10h instead of 4h and more logs

This commit is contained in:
Bla 2023-11-05 22:45:25 +00:00
parent c6b291e4d1
commit 633bef1718

View file

@ -70,7 +70,7 @@ def idIsRecent(id):
def handleJson(jsonObj):
if isinstance(jsonObj, list):
if 'online-level' in jsonObj:
#typ = jsonObj[1]["LevelValues"][0]["Type"]
#type = jsonObj[1]["LevelValues"][0]["Type"]
value = jsonObj[1]["LevelValues"][0]["Values"][0]
NmtId = jsonObj[1]["NmtId"]
time = jsonObj[1]["Time"]
@ -107,6 +107,7 @@ def createDriver(id):
try:
driver = webdriver.Chrome(options=options)
except:
print ("creation failed badly, waiting 10s and retrying")
sleep(10)
driver = createDriver(id)
return driver
@ -117,9 +118,8 @@ def startRequest(driver):
try:
driver.get('https://dus-travis.dus.com/')
except:
print ("GET failed. Main loop will handle that")
pass
#sleep(10)
#startRequest(driver)
def assertWorking():
return lastaccess > datetime.now(timezone.utc) - timedelta(seconds=10)
@ -133,7 +133,7 @@ if __name__ == '__main__':
# wait time to restart will be dynamically adapted,
# if unexpected things happen in chrome or the real world
restartWait = timedelta(hours=4)
restartWait = timedelta(hours=10)
# setup webdriver
d0 = createDriver(0)
@ -168,8 +168,8 @@ if __name__ == '__main__':
print ("Something stupid happened, setting interval to 3m")
else:
if restartWait < timedelta(hours=1):
restartWait = timedelta(hours=4)
print ("Something stupid normalized, resetting interval to 4h")
restartWait = timedelta(hours=10)
print ("Something stupid normalized, resetting interval to 10h")