Here are the options:
- Do nothing
- Retry once
- Retry thrice
- Retry until succeed
Do nothing
If I do nothing when SetAsync errors, the player just loses their data. Auto save could minimise the loss of data, but the player will still lose data.
Retry once
This could prevent the loss of data, but what if the retry also fails? The player will still lose data.
Retry thrice
Same as above. The retries could still fail, and the player will still lose data.
Retry until succeed
This seems like a good solution at first (at least to me), however, if the player tries to join another server while the original server is still retrying to save the data, the player in the other server would be getting his old data and if the retries finally succeed, their data in the other server does not update.
You could check if the player previously had their data saved successfully when they join a server, by checking a boolean saved along with their data, which is set to true when the player leaves and their data is saved, and set to false when the player joins the game. So when the player joins, the bool is set to false, and if they leave and the save fails, the bool remains false. So if they try to join another server, the bool will be false, allowing you to tell your player that their data was not saved.
However all of these result in the same thing- the player’s data could still be lost. But that is something that is inevitable.
How would you approach this?