Fix hostname issue on machines without ".local" in hostname and handle missed TimeOut exception

This commit is contained in:
Brett Williams
2023-06-10 16:07:58 -05:00
parent 38936d40ab
commit 2763a0c97f
2 changed files with 6 additions and 2 deletions

View File

@@ -542,7 +542,8 @@ def start_server(background_thread=False):
server.config['MAX_CONTENT_PATH'] = config['max_content_path']
# Get hostname and render clients
RenderQueue.hostname = socket.gethostname()
local_hostname = socket.gethostname()
RenderQueue.hostname = local_hostname + (".local" if not local_hostname.endswith(".local") else "")
server.config['HOSTNAME'] = RenderQueue.hostname
# disable most Flask logging

View File

@@ -64,8 +64,11 @@ class RenderServerProxy:
return req.json()
except json.JSONDecodeError as e:
logger.debug(f"JSON decode error: {e}")
except requests.ReadTimeout as e:
logger.warning(f"Timed out: {e}")
self.__offline_flags = self.__offline_flags + 1
except requests.ConnectionError as e:
logger.error(f"Connection error: {e}")
logger.warning(f"Connection error: {e}")
self.__offline_flags = self.__offline_flags + 1
except Exception as e:
logger.exception(f"Uncaught exception: {e}")