fix(wormhole): remove wait_until_ready() from _init() to prevent load timeout

Root cause: _init() was blocking on wait_until_ready() for up to 30 seconds,
causing Red's package load to timeout. Red then reports 'Failed to load
package wormhole (timeout)' but the cog is actually partially loaded,
causing 'already loaded' errors on retry.

Timeline:
1. [p]load wormhole starts
2. setup() calls bot.add_cog(cog) ✓
3. setup() calls await cog._init()
4. _init() blocks on wait_until_ready() for 30s
5. Red's load timeout (30s) triggers
6. Red reports 'timeout' but cog is registered
7. [p]load wormhole again → 'already loaded' error

Solution: Remove wait_until_ready() from _init() since:
- Bot is already ready when cogs load on startup
- Background loops have their own wait_until_ready() calls
- _init() shouldn't block setup()

Background loops still wait_until_ready() independently (correct behavior).

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
root 2026-05-26 16:43:46 +00:00
parent 6fd48e93af
commit 2f97926ca6

View file

@ -137,7 +137,8 @@ class WormholeV4(
async def _init(self) -> None:
"""Deferred initialisation — called from setup() after cog is added."""
await self.bot.wait_until_ready()
# Don't wait_until_ready() - causes 30s timeout during cog load
# Bot is already ready when cogs load on startup
nets = await self.config.networks()
for name, nd in nets.items():
r = nd.get("rate_limit_rate", 5)