CC-5227 - Sometimes Liquidsoap telnet is unresponsive which causes all Pypo threads to block

-restart Liquidsoap if communication fails..
This commit is contained in:
Martin Konecny 2013-06-11 17:26:48 -04:00
parent f164cf0ad4
commit 21c84dcaad
2 changed files with 7 additions and 0 deletions

View File

@ -40,9 +40,13 @@ signal.signal(signal.SIGINT, keyboardInterruptHandler)
POLL_INTERVAL = 1800
class PypoFetch(Thread):
def __init__(self, pypoFetch_q, pypoPush_q, media_q, telnet_lock, pypo_liquidsoap, config):
Thread.__init__(self)
#Hacky...
PypoFetch.ref = self
self.api_client = api_client.AirtimeApiClient()
self.fetch_queue = pypoFetch_q
self.push_queue = pypoPush_q

View File

@ -1,6 +1,8 @@
import threading
import logging
import pypofetch
def __timeout(func, timeout_duration, default, args, kwargs):
class InterruptableThread(threading.Thread):
@ -24,6 +26,7 @@ def __timeout(func, timeout_duration, default, args, kwargs):
fails again then there is something critically wrong..."""
if first_attempt:
#restart liquidsoap
pypofetch.PypoFetch.ref.restart_liquidsoap()
pass
else:
raise Exception("Thread did not terminate")