diff --git a/modules/communication/liquidsoap/client.py b/modules/communication/liquidsoap/client.py index 84b2aba8ed5ca37a8b5c016ad548866f3f353c87..ba73b14d0c7d541f5f2352efa7929419bebba8a6 100644 --- a/modules/communication/liquidsoap/client.py +++ b/modules/communication/liquidsoap/client.py @@ -1,14 +1,10 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -import os -import sys -import time import socket import urllib.parse import configparser import logging -from io import StringIO from multiprocessing import Lock from libraries.exceptions.auraexceptions import LQConnectionError @@ -54,9 +50,11 @@ class LiquidSoapClient: self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.connect(self.socket_path) except socket.error as e: + msg = "Cannot connect to socketpath " + self.socket_path + ". Reason: "+str(e) + self.logger.critical(msg) self.can_connect = False self.connected = False - raise e +# raise e else: self.can_connect = True self.connected = True diff --git a/modules/communication/liquidsoap/communicator.py b/modules/communication/liquidsoap/communicator.py index 2ae2356daf2028db7499b9bace78c56ff03642e6..33931b0049e3d8714266b6eaa43da594c967a9de 100644 --- a/modules/communication/liquidsoap/communicator.py +++ b/modules/communication/liquidsoap/communicator.py @@ -28,6 +28,7 @@ class LiquidSoapCommunicator(ExceptionLogger): error_data = None auramailer = None aborttransaction = False + connection_attempts = 0 # ------------------------------------------------------------------------------------------ # def __init__(self, config): @@ -1019,15 +1020,20 @@ class LiquidSoapCommunicator(ExceptionLogger): # say byebye if needed #if self.transaction == 0: # self.__close_conn(lqs_instance) + self.connection_attempts = 0 return result except LQConnectionError as e: if self.try_to_reconnect(): - return self.__send_lqc_command__(lqs_instance, namespace, command, *args) + self.connection_attempts += 1 + if self.connection_attempts < 5: + return self.__send_lqc_command__(lqs_instance, namespace, command, *args) + else: + raise e else: # also store when was last admin mail sent with which content... - self.logger.warning("SEND ADMIN MAIL AT THIS POINT") + self.logger.critical("SEND ADMIN MAIL AT THIS POINT") raise e # ------------------------------------------------------------------------------------------ #