major-domo-v2/commands/voice
Cal Corum 32cb5da632 CLAUDE: Refactor voice cleanup service to use @tasks.loop pattern
Problem:
- Voice cleanup service used manual while loop instead of @tasks.loop
- Did not wait for bot readiness before starting
- Startup verification could miss stale entries
- Manual channel deletions did not unpublish associated scorecards

Changes:
- Refactored VoiceChannelCleanupService to use @tasks.loop(minutes=1)
- Added @before_loop decorator with await bot.wait_until_ready()
- Updated bot.py to use setup_voice_cleanup() pattern
- Fixed scorecard unpublishing for manually deleted channels
- Fixed scorecard unpublishing for wrong channel type scenarios
- Updated cleanup interval from 60 seconds to 1 minute (same behavior)
- Changed cleanup reason message from "15+ minutes" to "5+ minutes" (matches actual threshold)

Benefits:
- Safe startup: cleanup waits for bot to be fully ready
- Reliable stale cleanup: startup verification guaranteed to run
- Complete cleanup: scorecards unpublished in all scenarios
- Consistent pattern: follows same pattern as other background tasks
- Better error handling: integrated with discord.py task lifecycle

Testing:
- All 19 voice command tests passing
- Updated test fixtures to handle new task pattern
- Fixed test assertions for new cleanup reason message

Documentation:
- Updated commands/voice/CLAUDE.md with new architecture
- Documented all four cleanup scenarios for scorecards
- Added task lifecycle information
- Updated configuration section

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 00:05:35 -05:00
..
__init__.py CLAUDE: Implement voice channel management system 2025-09-24 23:17:39 -05:00
channels.py CLAUDE: Add automatic scorecard unpublishing when voice channels are cleaned up 2025-10-21 07:18:21 -05:00
CLAUDE.md CLAUDE: Refactor voice cleanup service to use @tasks.loop pattern 2025-10-24 00:05:35 -05:00
cleanup_service.py CLAUDE: Refactor voice cleanup service to use @tasks.loop pattern 2025-10-24 00:05:35 -05:00
tracker.py CLAUDE: Add automatic scorecard unpublishing when voice channels are cleaned up 2025-10-21 07:18:21 -05:00