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