Conversation
Duplicate of #50533 — both add a configurable Discord voice inactivity timeout (with |
|
Closing as duplicate. Existing upstream PRs already cover this area; I am handling the local solution by pinning selected PRs on top of our hermes-stack instead. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing the configurable Discord voice timeout. The premise remains valid on current main: VOICE_TIMEOUT is still hardcoded at plugins/platforms/discord/adapter.py:816, and _voice_timeout_handler() sleeps on it at :3026.
Problems
plugins/platforms/discord/adapter.py:2961cancels the existing inactivity task before mixer decode / legacy playback setup. Current main allows exceptions from those later operations (decode_to_pcmat:2946,FFmpegPCMAudioat:2988), but this change only re-arms on successful playback paths. An exception therefore leaves a connected guild with no inactivity task.
Suggested changes
- Put the cancellation and playback body under
try/finally; in thefinally, re-arm only if the guild remains connected and the configured timeout is enabled. - Add a regression test for a decoder or FFmpeg setup exception after cancellation.
Automated hermes-sweeper review.
| vc = self._voice_clients.get(guild_id) | ||
| if not vc or not vc.is_connected(): | ||
| return False | ||
| self._cancel_voice_timeout(guild_id) |
There was a problem hiding this comment.
Please re-arm the timer in a finally around the remaining playback attempt. decode_to_pcm, FFmpegPCMAudio, or vc.play can raise after this cancellation; the current success-only resets then leave a connected guild with no inactivity timer.
|
The configurable voice timeouts landed in #73517 via @namredips's #50533 (this was already labeled duplicate). Thanks for the contribution! (Landed via #73517, merge |
Summary
discord.voice_inactivity_timeout_secondsfor Discord voice-channel auto-leave, preserving the historical 300s default and supporting0to disable auto-leave.Test Plan
uv run --with pytest --with pytest-asyncio --with pyyaml python -m pytest tests/gateway/test_config.py::TestLoadGatewayConfig::test_bridges_discord_voice_inactivity_timeout_from_config_yaml tests/gateway/test_voice_command.py::TestVoiceTimeoutCleansRunnerState -q -o 'addopts=' --tb=short(12 passed)uv run --with pytest --with pytest-asyncio --with pyyaml python -m pytest tests/gateway/test_voice_command.py -q -o 'addopts=' --tb=short(171 passed, 21 skipped)uv run --with pytest --with pytest-asyncio --with pyyaml python -m pytest tests/gateway/test_config.py -q -o 'addopts=' --tb=short(86 passed)uv run --with pytest --with pytest-asyncio --with pyyaml python -m pytest tests/gateway/test_discord_voice_mixer.py -q -o 'addopts=' --tb=short(1 skipped; pytest exit 5 because the file contains only skipped tests in this environment)python -m compileall -q plugins/platforms/discord/adapter.py gateway/config.pyPlatforms Tested