Bedrockifier
Bedrockifier copied to clipboard
Improved User & State Handling
First, the backup service assumes that there is nobody logged in when it connects to the server console. It should issue a command to list the players as it connects so it is in sync with the server state. Also, we don’t record any information about state between runs, which means we are limited in the type of logic that can be used to decide when to backup or not.
With the extra reliability of knowing when players are actually active on the server, this can be used to limit the number of backups made. For example, the below configuration would check if it should do a backup every hour, but would only backup if:
- A backup hadn’t already been made in the last 3 hours.
- A user had been logged in at some point since the last backup.
schedule:
interval: 1h
minInterval: 3h
requireActivity: true
A configuration such as this would mean that at most, one would lose about 3 hours of work, but backups won’t be made during downtime when nobody has been playing. A simpler solution that just backs up every hour, but only if players are active could look like this:
schedule:
interval: 1h
requireActivity: true
The drawback being that while you are getting more frequent backups and will lose less work, you can get “spikes” on days where there’s a lot of activity. Some days getting 3 backups, others getting 24. So users would need to account for the sort of ‘worst-case’ scenario of heavy usage days in their configuration.