Skip to content
Snippets Groups Projects
Commit 40f1e42b authored by Gottfried Gaisbauer's avatar Gottfried Gaisbauer
Browse files

removed endless recursion when database is empty and connection to pv cannot be established

parent 4d2e8aa0
Branches
No related tags found
No related merge requests found
......@@ -43,9 +43,6 @@ class Aura(AuraCommon):
signal.signal(signal.SIGUSR1, receive_signal)
# addition initialization
self.scheduler.fetch_new_programme()
def join_comm(self):
# start listener thread
self.messenger.start()
......
......@@ -76,6 +76,7 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
active_entry = None
logger = None
config = None
tried_fetching = 0
def __init__(self, config):
"""
......@@ -333,6 +334,13 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
# ------------------------------------------------------------------------------------------ #
def fetch_new_programme(self):
if self.tried_fetching == 5:
self.logger.error("Cannot connect to PV! No Programme loaded!")
self.tried_fetching = 0
return ""
self.tried_fetching += 1
acs = AuraCalendarService(self.config)
queue = acs.get_queue()
......@@ -344,6 +352,9 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
if response == "fetching_finished":
self.load_programme_from_db()
if self.programme is not None and len(self.programme) > 0:
self.tried_fetching = 0
return self.get_act_programme_as_string()
else:
self.logger.warning("Got an unknown response from AuraCalendarService: " + response)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment