freyacodes / archived-bot

A Discord music bot serving music in over 3 million discord servers
https://fredboat.com/docs
MIT License
487 stars 210 forks source link

Rejoin channels on shard reconnect #403

Closed schnapster closed 6 years ago

schnapster commented 6 years ago

I'm not entirely sure what actually happens when a shard has to do a reconnect (and resume too), what it should do is reconnect to the channels it was playing in, similar to the mechanism we have in place for reviving shards. We can probably use JDA's onDisconnect/onResume/onReconnect events for this.

One thing to note is that if we do rejoin a channel, to check whether it was emptied in the meantime, and pause ourselves in that case.

If this happens already automatically this issue can be closed upon confirmation.

schnapster commented 6 years ago

Metrics graphs and event logs suggest that we loose audio connections during resumes, so this is definitely a relevant issue.

schnapster commented 6 years ago

Tested this with latest LL and FB code, resumes are not handled optimally. The bot always leaves the voicechat, music is paused, unpaused on rejoin. Sometimes it does not rejoin, and therefore does not continue the playback.

Reconnects break it worse: Never rejoins the voicechat, but always keeps playing.

freyacodes commented 6 years ago

Can you reopen as a Lavalink issue then?