Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

perf(realtime): import transport plugins off the loop during boot warm

rubenluetke10-beep1c4bd560132c
diff --git a/jarvis/realtime/factory.py b/jarvis/realtime/factory.py
index da84e3b3ed..6913041d45 100644
--- a/jarvis/realtime/factory.py
+++ b/jarvis/realtime/factory.py
@@ -9,6 +9,7 @@ whether the feature is available (AP-21/AP-22).
from __future__ import annotations
+import asyncio
import logging
from typing import Any
@@ -295,7 +296,12 @@ async def realtime_warm_selected_transports(cfg: Any) -> None:
return
for position, provider_id in enumerate(_explicit_provider_ids(cfg)):
try:
- provider_cls = load(_GROUP, provider_id, protocol=RealtimeProvider)
+ # Importing a provider plugin is synchronous module work (189 ms
+ # warm for openai-live, seconds on a cold boot disk); this runs as
+ # a boot task on the shared loop, so the import goes to a thread.
+ provider_cls = await asyncio.to_thread(
+ load, _GROUP, provider_id, protocol=RealtimeProvider
+ )
if position > 0 and not bool(
getattr(provider_cls, "eager_warm_as_fallback", False)
):
@@ -342,7 +348,10 @@ async def realtime_prespawn_transports(cfg: Any) -> None:
return
for provider_id in _explicit_provider_ids(cfg):
try:
- provider_cls = load(_GROUP, provider_id, protocol=RealtimeProvider)
+ # Off the loop for the same reason as the warm above.
+ provider_cls = await asyncio.to_thread(
+ load, _GROUP, provider_id, protocol=RealtimeProvider
+ )
prespawn = getattr(provider_cls, "prespawn_transport", None)
if callable(prespawn):
await prespawn(cfg)