From 832f4d871dff98cca72f69f62333035ef2cf6fe5 Mon Sep 17 00:00:00 2001 From: Bob Haddleton Date: Tue, 15 Sep 2026 11:22:26 -0500 Subject: [PATCH] fix(runtime): Handle RuntimeError for event loop --- crossplane/function/runtime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crossplane/function/runtime.py b/crossplane/function/runtime.py index fe6d02f..a6e465e 100644 --- a/crossplane/function/runtime.py +++ b/crossplane/function/runtime.py @@ -95,7 +95,10 @@ def serve( are supplied. """ # Define the loop before the server so everything uses the same loop. - loop = asyncio.get_event_loop() + try: + loop = asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() server = grpc.aio.server(options=options)