feat(playout): remove stream_setting update handler
This commit is contained in:
parent
f5a83dbabb
commit
2fa045a8ef
|
@ -80,9 +80,6 @@ class PypoMessageHandler(Thread):
|
|||
elif command == "reset_liquidsoap_bootstrap":
|
||||
logger.info("Resetting bootstrap vars...")
|
||||
self.pypo_queue.put(message)
|
||||
elif command == "update_stream_setting":
|
||||
logger.info("Updating stream setting...")
|
||||
self.pypo_queue.put(message)
|
||||
elif command == "update_stream_format":
|
||||
logger.info("Updating stream format...")
|
||||
self.pypo_queue.put(message)
|
||||
|
|
|
@ -45,9 +45,6 @@ class PypoFetch(Thread):
|
|||
):
|
||||
Thread.__init__(self)
|
||||
|
||||
# Hacky...
|
||||
PypoFetch.ref = self
|
||||
|
||||
self.api_client = api_client
|
||||
self.legacy_client = legacy_client
|
||||
self.fetch_queue = fetch_queue
|
||||
|
@ -86,9 +83,6 @@ class PypoFetch(Thread):
|
|||
self.process_schedule(self.schedule_data)
|
||||
elif command == "reset_liquidsoap_bootstrap":
|
||||
self.set_bootstrap_variables()
|
||||
elif command == "update_stream_setting":
|
||||
logger.info("Updating stream setting...")
|
||||
self.regenerate_liquidsoap_conf(m["setting"])
|
||||
elif command == "update_stream_format":
|
||||
logger.info("Updating stream format...")
|
||||
self.update_liquidsoap_stream_format(m["stream_format"])
|
||||
|
@ -155,21 +149,6 @@ class PypoFetch(Thread):
|
|||
self.pypo_liquidsoap.clear_all_queues()
|
||||
self.pypo_liquidsoap.clear_queue_tracker()
|
||||
|
||||
def restart_liquidsoap(self):
|
||||
try:
|
||||
logger.info("Restarting Liquidsoap")
|
||||
self.liq_client.restart()
|
||||
logger.info("Liquidsoap is up and running")
|
||||
|
||||
except Exception as exception:
|
||||
logger.exception(exception)
|
||||
|
||||
# NOTE: This function is quite short after it was refactored.
|
||||
|
||||
def regenerate_liquidsoap_conf(self, setting):
|
||||
self.restart_liquidsoap()
|
||||
self.update_liquidsoap_connection_status()
|
||||
|
||||
@ls_timeout
|
||||
def update_liquidsoap_connection_status(self):
|
||||
"""
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import threading
|
||||
|
||||
from .player import fetch
|
||||
|
||||
|
||||
def __timeout(func, timeout_duration, default, args, kwargs):
|
||||
class InterruptableThread(threading.Thread):
|
||||
|
@ -14,27 +12,15 @@ def __timeout(func, timeout_duration, default, args, kwargs):
|
|||
def run(self):
|
||||
self.result = func(*args, **kwargs)
|
||||
|
||||
first_attempt = True
|
||||
|
||||
while True:
|
||||
thread = InterruptableThread()
|
||||
thread.start()
|
||||
if not first_attempt:
|
||||
timeout_duration = timeout_duration * 2
|
||||
thread.join(timeout_duration)
|
||||
|
||||
if thread.is_alive():
|
||||
# Restart Liquidsoap and try the command one more time. If it
|
||||
# fails again then there is something critically wrong...
|
||||
if first_attempt:
|
||||
# restart liquidsoap
|
||||
fetch.PypoFetch.ref.restart_liquidsoap()
|
||||
else:
|
||||
raise Exception("Thread did not terminate")
|
||||
else:
|
||||
return thread.result
|
||||
raise Exception("Thread did not terminate")
|
||||
|
||||
first_attempt = False
|
||||
return thread.result
|
||||
|
||||
|
||||
def ls_timeout(func, timeout=15, default=None):
|
||||
|
|
Loading…
Reference in New Issue