mahjong icon indicating copy to clipboard operation
mahjong copied to clipboard

Determine how to handle client desyncs

Open randomPoison opened this issue 5 years ago • 2 comments

We need a generalized solution around how we handle desyncs in the client. Currently we're doing a pretty good job of sending the client the necessary pieces of information needed to validate that its local state is still in sync with the server, but we've haven't fleshed out what we actually do when a desync is detected.

randomPoison avatar Jun 06 '20 00:06 randomPoison

My current thinking is that we should simply throw an exception anywhere we detect a desync, and have a root try/catch block at the top-level of the control flow for each controller. This would play nicely with our current async-everywhere approach and would allow us to specialize the handling to the active part of the game (e.g. have a different desync handling approach for mahjong matches vs being on the main menu). This also avoids the tedium that comes with having to try to handle desyncs in each location where we receive an event from the server.

randomPoison avatar Jun 06 '20 01:06 randomPoison

Oh, I completely forgot that I had even already added OutOfSyncException to the client project. I'm going to experiment with this approach going forward and try to track what works well and what issues I run into in the process.

randomPoison avatar Jun 06 '20 04:06 randomPoison