8000 fix: Use none check to avoid 30s delay in agent run. · googleapis/python-aiplatform@84895b6 · GitHub
[go: up one dir, main page]

Skip to con 10000 tent

Commit 84895b6

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
fix: Use none check to avoid 30s delay in agent run.
PiperOrigin-RevId: 770280829
1 parent 7f964d5 commit 84895b6

File tree

1 file changed

+5
-3
lines changed
  • vertexai/preview/reasoning_engines/templates

1 file changed

+5
-3
lines changed

vertexai/preview/reasoning_engines/templates/adk.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,15 +627,17 @@ def _asyncio_thread_main():
627627
asyncio.run(_invoke_agent_async())
628628
except RuntimeError as e:
629629
event_queue.put(e)
630+
finally:
631+
# Use None as a sentinel to stop the main thread.
632+
event_queue.put(None)
630633

631634
thread = threading.Thread(target=_asyncio_thread_main)
632635
thread.start()
633636

634637
try:
635638
while True:
636-
try:
637-
event = event_queue.get(timeout=30)
638-
except queue.Empty:
639+
event = event_queue.get()
640+
if event is None:
639641
break
640642
if isinstance(event, RuntimeError):
641643
raise event

0 commit comments

Comments
 (0)
0