Skip to content

Commit 42d04ec

Browse files
committed
Allow nested event loops
1 parent 201d4b9 commit 42d04ec

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ build = [
4141
# guarded with optional_import() calls.
4242
"virtualenv>=20.4",
4343
"PyYAML>=6.0",
44+
"nest-asyncio>=1.6.0"
4445
]
4546
test = [
4647
"isolate[build]",

src/isolate/connections/grpc/agent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,10 @@ async def main() -> int:
252252

253253

254254
if __name__ == "__main__":
255+
# The fal app sdk runs its own asyncio evet loop, so we need to patch asyncio
256+
# here to allow nested event loops to avoid "loop is already running" errors.
257+
import nest_asyncio
258+
259+
nest_asyncio.apply()
260+
255261
asyncio.run(main())

0 commit comments

Comments
 (0)