CC-5729: Pypo race condition on show source kick event kills playout
* Fixed a race condition in pypo which could kill playout. Input kick events and non-file/webstream events could result in an exception being thrown. Fixed the logic error behind this, caught the exception just in case, and added some code to prevent uncaught pypopush exceptions from terminating the thread. * Could prevent playout breakage in similar situations
This commit is contained in:
parent
7660e0cd84
commit
73cbead4c3
2 changed files with 72 additions and 68 deletions
|
@ -117,7 +117,7 @@ class PypoLiquidsoap():
|
||||||
#independent_event: true
|
#independent_event: true
|
||||||
#},
|
#},
|
||||||
|
|
||||||
|
try:
|
||||||
scheduled_now_files = \
|
scheduled_now_files = \
|
||||||
filter(lambda x: x["type"] == eventtypes.FILE, scheduled_now)
|
filter(lambda x: x["type"] == eventtypes.FILE, scheduled_now)
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ class PypoLiquidsoap():
|
||||||
self.logger.info("Need to add items to Liquidsoap *now*: %s" % \
|
self.logger.info("Need to add items to Liquidsoap *now*: %s" % \
|
||||||
to_be_added)
|
to_be_added)
|
||||||
|
|
||||||
for i in scheduled_now:
|
for i in scheduled_now_files:
|
||||||
if i["row_id"] in to_be_added:
|
if i["row_id"] in to_be_added:
|
||||||
self.modify_cue_point(i)
|
self.modify_cue_point(i)
|
||||||
self.play(i)
|
self.play(i)
|
||||||
|
@ -187,6 +187,9 @@ class PypoLiquidsoap():
|
||||||
#something is playing and it shouldn't be.
|
#something is playing and it shouldn't be.
|
||||||
self.telnet_liquidsoap.stop_web_stream_buffer()
|
self.telnet_liquidsoap.stop_web_stream_buffer()
|
||||||
self.telnet_liquidsoap.stop_web_stream_output()
|
self.telnet_liquidsoap.stop_web_stream_output()
|
||||||
|
except KeyError as e:
|
||||||
|
self.logger.error("Error: Malformed event in schedule. " + str(e))
|
||||||
|
|
||||||
|
|
||||||
def stop(self, queue):
|
def stop(self, queue):
|
||||||
self.telnet_liquidsoap.queue_remove(queue)
|
self.telnet_liquidsoap.queue_remove(queue)
|
||||||
|
@ -200,8 +203,7 @@ class PypoLiquidsoap():
|
||||||
self.liq_queue_tracker[i] = None
|
self.liq_queue_tracker[i] = None
|
||||||
|
|
||||||
def modify_cue_point(self, link):
|
def modify_cue_point(self, link):
|
||||||
if not self.is_file(link):
|
assert self.is_file(link)
|
||||||
return
|
|
||||||
|
|
||||||
tnow = datetime.utcnow()
|
tnow = datetime.utcnow()
|
||||||
|
|
||||||
|
|
|
@ -153,8 +153,10 @@ class PypoPush(Thread):
|
||||||
self.telnet_lock.release()
|
self.telnet_lock.release()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
while True:
|
||||||
try: self.main()
|
try: self.main()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
top = traceback.format_exc()
|
top = traceback.format_exc()
|
||||||
self.logger.error('Pypo Push Exception: %s', top)
|
self.logger.error('Pypo Push Exception: %s', top)
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue