8000 fix(voice): don't spin the audio receiver while DAVE isn't ready by thomas-vilte · Pull Request #639 · disgoorg/disgo · GitHub
[go: up one dir, main page]

Skip to content

fix(voice): don't spin the audio receiver while DAVE isn't ready - #639

Merged
topi314 merged 2 commits into
disgoorg:masterfrom
thomas-vilte:fix/voice-receiver-dave-spin
Oct 28, 2026
Merged

topi314 merged 2 commits into
disgoorg:masterfrom
thomas-vilte:fix/voice-receiver-dave-spin

Conversation

@thomas-vilte
Copy link
Copy Markdown
Contributor

When DAVE isn't ready, receive() returns right away and open() calls it again with no wait. It never gets to ReadPacket (the only call that blocks), so the loop spins until the session is ready. That happens during every handshake and transition, or forever if the session never recovers.

With a stub session that never becomes ready, I measured ~72M Ready() checks and a full core used in one second. With this change it's 50 checks and ~2ms of CPU: it waits one frame (20ms) before checking again, same as the sender loop does between frames.

This only affects bots that receive audio. Mine only sends, so I don't have prod numbers for this one, just the test.

It doesn't depend on #604: that one delays starting the loops until UDP is ready, but DAVE still isn't ready during the handshake after that, so the spin is still there. The only overlap is the import block.

Comment thread voice/audio_receiver_test.go Resolved
@topi314
topi314 merged commit 7a13ca3 into disgoorg:master Oct 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants

0