WorldQL / mammoth

Scale a single world horizontally across multiple Minecraft servers.
https://www.worldql.com/posts/2021-08-worldql-scalable-minecraft/
MIT License
857 stars 47 forks source link

Improve reliability by automatically reconnecting to the WorldQL server if it DCs (no clientbound heartbeats for a while). #55

Closed Jaxkr closed 2 years ago

Jaxkr commented 2 years ago

Right now the handshake process seems to be very error prone and can cause servers to disconnect. Additionally, if the WorldQL server is restarted the clients have no way to reconnect (without restarting themselves).

Replacing the handshake message with a combined handshake/heartbeat would solve this. This heartbeat packet would function as an idempotent handshake in which the client says "hey, I'm still here and btw my port and host are x in case you've never seen me before".

Jaxkr commented 2 years ago

Another option is to have the server send heartbeats to the client as well. This would allow the client to detect when the server has died and send another handshake. This would require less re-engineering and be more elegant.

luludotdev commented 2 years ago

Heartbeats are already echoed back as-is to the server that sent them, should be pretty trivial to keep a track of missed heartbeats and reconnect.

Jaxkr commented 2 years ago

Heartbeats are already echoed back as-is to the server that sent them, should be pretty trivial to keep a track of missed heartbeats and reconnect.

Oh sweet. I'll add a timer to the Mammoth plugin that sends another handshake if too much time has passed.