Split the node types into a package, and stop reconnecting per message

nodes.py had grown to 2k lines holding every integration behind a single
blanket mypy exemption. It is now a package split by the outside world
each node talks to, so the exemption shrinks to the four integration
modules; base and mlp are type-checked, which turned up a dozen missing
annotations.

The senders opened a fresh connection — and, in the MQTT case, a fresh
thread pool and event loop — for every single message. HTTP senders now
share one pooled client, and a publisher holds one broker connection for
its lifetime, fed from a bounded queue that drops the oldest value when
the broker cannot keep up.

An HTTP sender also no longer trips over a JSON reply that is not an
object: outputs are keyed by port, so a bare scalar is a valid reply with
nothing to publish.
This commit is contained in:
root
2026-08-16 07:33:10 +02:00
parent 3a8edae928
commit 69246c4272
12 changed files with 2308 additions and 2038 deletions
+2
View File
@@ -15,6 +15,7 @@ from app.core.config import settings
from app.flow import logs
from app.flow.controller import FlowController
from app.flow.events import event_bus
from app.flow.nodes.http import close_shared_client
from app.flow.plugins import load_plugins
from app.flow.secrets import init_secrets
from app.flow.state import MemoryState, RedisState, StateBackend
@@ -75,6 +76,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
finally:
watchdog_task.cancel()
await controller.stop()
close_shared_client()
if settings.MCP_ENABLED:
from app.mcp.http import aclose