modify: mqtt 启动
This commit is contained in:
@@ -40,6 +40,9 @@ async def lifespan(app: FastAPI):
|
||||
# 2. Zenoh
|
||||
session = lifespan_setup.setup_zenoh(app)
|
||||
|
||||
# 3. mqtt broker
|
||||
lifespan_setup.setup_mqtt_broker(app, host=config[env]["mqtt"]["host"], port=config[env]["mqtt"]["port"])
|
||||
|
||||
# 4. WorkerManager
|
||||
manager = lifespan_setup.setup_worker_manager(app, session)
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ async def setup_mqtt(app: FastAPI, worker_manager: WorkerManager) -> MQTTBridge
|
||||
custom_topics += list(getattr(app.state, "plugin_mqtt_topics", []) or [])
|
||||
|
||||
# 1. 启动 Broker 子进程(文件锁已确保只有一个)
|
||||
setup_mqtt_broker(app, host, port)
|
||||
# setup_mqtt_broker(app, host, port)
|
||||
|
||||
# 2. 原子锁确保只有一个 worker 启动 MQTT Bridge
|
||||
if not _acquire_singleton_lock("mqtt_bridge"):
|
||||
|
||||
Reference in New Issue
Block a user