Commit b037748b authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Make handler stop automatically after 25 minutes in case it stalls

parent 2cb50488
Pipeline #225 skipped
......@@ -4,7 +4,7 @@ from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
import urllib.request, urllib.error, urllib.parse, time, os
import multiprocessing, urllib.request, urllib.error, urllib.parse, time, os
import dbtools, phototools, setuptools
currentRun = []
......@@ -109,11 +109,18 @@ def siteHandler(driver, mode = 0, p = 0, db = dbtools.dbHelper()):
if pageHandler(driver, db):
siteHandler(driver, mode, p+1, db)
def mainHandler():
siteHandler(driver, db=db)
siteHandler(driver, 1, db=db)
if __name__ == "__main__":
db = dbtools.dbHelper()
driver = webdriver.Firefox()
if loginHandler(driver):
siteHandler(driver, db=db)
siteHandler(driver, 1, db=db)
p = multiprocessing.Process(target=mainHandler)
p.start()
p.join(1500)
if p.is_alive():
p.terminate()
p.join()
driver.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment