Run branch.reader in bg thread

This commit is contained in:
Nuno Campos
2024-09-04 12:13:38 -07:00
parent 4efab93e2f
commit b68f9211c2
+2 -1
View File
@@ -1,3 +1,4 @@
import asyncio
import logging
from collections import defaultdict
from typing import (
@@ -97,7 +98,7 @@ class Branch(NamedTuple):
writer: Callable[[list[str], RunnableConfig], Optional[Runnable]],
) -> Runnable:
if reader:
value = reader(config)
value = await asyncio.to_thread(reader, config)
# passthrough additional keys from node to branch
# only doable when using dict states
if isinstance(value, dict) and isinstance(input, dict):