Skip to content

fix: use running loop in audio helpers#3299

Open
Ghraven wants to merge 1 commit into
openai:mainfrom
Ghraven:fix/audio-helpers-running-loop
Open

fix: use running loop in audio helpers#3299
Ghraven wants to merge 1 commit into
openai:mainfrom
Ghraven:fix/audio-helpers-running-loop

Conversation

@Ghraven
Copy link
Copy Markdown

@Ghraven Ghraven commented May 22, 2026

Summary

  • Replace asyncio.get_event_loop() with asyncio.get_running_loop() in audio helper async methods
  • Keep the callback/executor loop reference tied to the active running loop

Problem

The audio helper methods are already async methods, but they currently call asyncio.get_event_loop() before using the loop for thread-safe callback notifications and executor work. get_event_loop() has legacy behavior in modern Python when no loop is set by policy; inside async code, get_running_loop() is the clearer and more precise API.

Before / After

Before, the helpers asked asyncio for the policy/current loop with get_event_loop().

After, they capture the loop that is actively running the coroutine with get_running_loop().

Verification

  • python -m compileall -q src\openai\helpers\local_audio_player.py src\openai\helpers\microphone.py
  • git diff --check

@Ghraven Ghraven requested a review from a team as a code owner May 22, 2026 04:31
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.

1 participant