Skip to content

Conversation

@tinalenguyen
Copy link
Member

No description provided.

@chenghao-mou chenghao-mou requested a review from a team January 6, 2026 18:47
Copy link
Member

@theomonnom theomonnom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

)

loop = asyncio.get_event_loop()
asyncio.run_coroutine_threadsafe(simulate_job(), loop)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

     loop = asyncio.get_event_loop()
+    _task: asyncio.Task | None = None
+
     @server.once("worker_started")
     def _simulate_job() -> None:
+        nonlocal _task
+
         async def simulate_job() -> None:
             async with api.LiveKitAPI(url, api_key, api_secret) as lk_api:
                 room_request = api.ListRoomsRequest(names=[room])
                 active_room = await lk_api.room.list_rooms(room_request)
                 if not active_room.rooms:
                     room_info = await lk_api.room.create_room(api.CreateRoomRequest(name=room))
                 else:
                     room_info = active_room.rooms[0]
             await server.simulate_job(
                 room=room,
                 fake_job=False,
                 room_info=room_info,
                 agent_identity=participant_identity,
             )
-        loop = asyncio.get_event_loop()
-        asyncio.run_coroutine_threadsafe(simulate_job(), loop)
+        _task = asyncio.create_task(simulate_job())

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_coroutine_threadsafe isn't needed here

@tinalenguyen tinalenguyen merged commit 4091ec7 into main Jan 8, 2026
16 of 18 checks passed
@tinalenguyen tinalenguyen deleted the tina/update-connect-cli-command branch January 8, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants