run_daemon timeout

This commit is contained in:
2025-05-28 13:55:30 +00:00
parent 5a5c613814
commit 7ec6ca605f
+10 -1
View File
@@ -21,8 +21,17 @@ def run(webPath):
print(now.strftime("%Y-%m-%d %H:%M:%S"), webPath, flush=True)
startTime = getCurrentMillisecTime()
obj = urllib.request.urlopen(webPath)
try:
obj = urllib.request.urlopen(webPath, timeout=60)
obj.read()
except urllib.error.HTTPError as e:
print('HTTPError:', e.code, webPath)
except urllib.error.URLError as e:
print('URLError:', e.reason, webPath)
except Exception as e:
print('Exception:', str(e), webPath)
else:
pass
timeGap = getCurrentMillisecTime() - startTime
if timeGap < RETRY_SEC * 1000: