mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-06-13 01:16:53 +02:00
better exception handling
This commit is contained in:
parent
7c44994070
commit
75d62096a6
@ -147,6 +147,7 @@ class FrigateApp():
|
|||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.init_logger()
|
self.init_logger()
|
||||||
|
try:
|
||||||
self.ensure_dirs()
|
self.ensure_dirs()
|
||||||
try:
|
try:
|
||||||
self.init_config()
|
self.init_config()
|
||||||
@ -158,6 +159,10 @@ class FrigateApp():
|
|||||||
self.init_queues()
|
self.init_queues()
|
||||||
self.init_database()
|
self.init_database()
|
||||||
self.init_mqtt()
|
self.init_mqtt()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
self.log_process.terminate()
|
||||||
|
sys.exit(1)
|
||||||
self.start_detectors()
|
self.start_detectors()
|
||||||
self.start_detected_frames_processor()
|
self.start_detected_frames_processor()
|
||||||
self.start_camera_processors()
|
self.start_camera_processors()
|
||||||
|
@ -27,6 +27,10 @@ def create_mqtt_client(config: MqttConfig):
|
|||||||
client.will_set(config.topic_prefix+'/available', payload='offline', qos=1, retain=True)
|
client.will_set(config.topic_prefix+'/available', payload='offline', qos=1, retain=True)
|
||||||
if not config.user is None:
|
if not config.user is None:
|
||||||
client.username_pw_set(config.user, password=config.password)
|
client.username_pw_set(config.user, password=config.password)
|
||||||
|
try:
|
||||||
client.connect(config.host, config.port, 60)
|
client.connect(config.host, config.port, 60)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Unable to connect to MQTT server: {e}")
|
||||||
|
raise
|
||||||
client.loop_start()
|
client.loop_start()
|
||||||
return client
|
return client
|
||||||
|
Loading…
Reference in New Issue
Block a user