From 42dad24ace3c853d67e56e3d07882a642b3afd2a Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 16 Dec 2020 08:36:04 -0500 Subject: [PATCH] test --- fHDHR/cli/run.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/fHDHR/cli/run.py b/fHDHR/cli/run.py index 778c6ea..49be508 100644 --- a/fHDHR/cli/run.py +++ b/fHDHR/cli/run.py @@ -52,13 +52,6 @@ def run(settings, logger, db, script_dir, fHDHR_web, origin, alternative_epg): if settings.dict["main"]["thread_method"] in ["multiprocessing", "threading"]: fhdhr_web.start() - # Perform some actions now that HTTP Server is running, but don't wait for response - # Hit EPG Update API URL without waiting - try: - fhdhr.web.session.get("%s/api/startup_tasks" % (fhdhr.api.base)) - except fhdhr.web.exceptions.ReadTimeout: - pass - if settings.dict["fhdhr"]["discovery_address"]: fhdhr.logger.info("SSDP Server Starting") if settings.dict["main"]["thread_method"] in ["multiprocessing"]: @@ -69,7 +62,7 @@ def run(settings, logger, db, script_dir, fHDHR_web, origin, alternative_epg): fhdhr_ssdp.start() if settings.dict["epg"]["method"]: - fhdhr.logger.info("EPG Update Starting") + fhdhr.logger.info("EPG Update Thread Starting") if settings.dict["main"]["thread_method"] in ["multiprocessing"]: fhdhr_epg = multiprocessing.Process(target=fhdhr.device.epg.run) elif settings.dict["main"]["thread_method"] in ["threading"]: @@ -77,6 +70,18 @@ def run(settings, logger, db, script_dir, fHDHR_web, origin, alternative_epg): if settings.dict["main"]["thread_method"] in ["multiprocessing", "threading"]: fhdhr_epg.start() + # Perform some actions now that HTTP Server is running, but don't wait for response + # Hit EPG Update API URL without waiting + fhdhr.logger.info("Waiting 3 seconds to send startup tasks trigger.") + time.sleep(3) + try: + fhdhr.web.session.get("%s/api/startup_tasks" % (fhdhr.api.base)) + except fhdhr.web.exceptions.ReadTimeout: + pass + except fhdhr.web.exceptions.ConnectionError as e: + fhdhr.logger.warning("Startup tasks failed: %s" % e) + pass + # wait forever while True: time.sleep(3600)