Added suppression of some errors we don't care about
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
from contextlib import suppress
|
||||||
from multiprocessing.connection import Client
|
from multiprocessing.connection import Client
|
||||||
from multiprocessing.connection import Listener
|
from multiprocessing.connection import Listener
|
||||||
|
|
||||||
@@ -40,8 +41,9 @@ class IPCServer(Singleton):
|
|||||||
|
|
||||||
def create_ipc_listener(self) -> None:
|
def create_ipc_listener(self) -> None:
|
||||||
if self._conn_type == "socket":
|
if self._conn_type == "socket":
|
||||||
if os.path.exists(self._ipc_address) and settings_manager.is_dirty_start():
|
if settings_manager.is_dirty_start():
|
||||||
os.unlink(self._ipc_address)
|
with suppress(FileNotFoundError, PermissionError):
|
||||||
|
os.unlink(self._ipc_address)
|
||||||
|
|
||||||
listener = Listener(address=self._ipc_address, family="AF_UNIX", authkey=self._ipc_authkey)
|
listener = Listener(address=self._ipc_address, family="AF_UNIX", authkey=self._ipc_authkey)
|
||||||
elif "unsecured" not in self._conn_type:
|
elif "unsecured" not in self._conn_type:
|
||||||
@@ -138,7 +140,8 @@ class IPCServer(Singleton):
|
|||||||
except ConnectionRefusedError as e:
|
except ConnectionRefusedError as e:
|
||||||
if self._conn_type == "socket":
|
if self._conn_type == "socket":
|
||||||
logger.error("IPC Socket no longer valid.... Removing.")
|
logger.error("IPC Socket no longer valid.... Removing.")
|
||||||
os.unlink(self._ipc_address)
|
with suppress(FileNotFoundError, PermissionError):
|
||||||
|
os.unlink(self._ipc_address)
|
||||||
except (OSError, ConnectionError, BrokenPipeError) as e:
|
except (OSError, ConnectionError, BrokenPipeError) as e:
|
||||||
logger.error( f"IPC connection error: {e}" )
|
logger.error( f"IPC connection error: {e}" )
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import inspect
|
import inspect
|
||||||
|
from contextlib import suppress
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
@@ -56,7 +57,8 @@ class StartCheckMixin:
|
|||||||
print(f"{APP_NAME} PID: {pid}")
|
print(f"{APP_NAME} PID: {pid}")
|
||||||
|
|
||||||
def _clean_pid(self):
|
def _clean_pid(self):
|
||||||
os.unlink(self.path_manager._PID_FILE)
|
with suppress(FileNotFoundError, PermissionError):
|
||||||
|
os.unlink(self.path_manager._PID_FILE)
|
||||||
|
|
||||||
def _write_pid(self, pid):
|
def _write_pid(self, pid):
|
||||||
with open(self.path_manager._PID_FILE, "w") as _pid:
|
with open(self.path_manager._PID_FILE, "w") as _pid:
|
||||||
|
|||||||
Reference in New Issue
Block a user