Introduce new lockstep syncing system, modularize sync modes #178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #69
This PR refactors the synchronization system and introduces a new
LOCKSTEP
sync mode, and modularizes the sync modes. It's my intent to make LOCKSTEP the default in the medium-term, though for now the old DELAY mode will remain as is (it works for most people, after-all). A newsync_mode
config option has also been added, and a newserver.yml
file to track the server name of each server (this can also be added to the data snapshots to provide a handy bit of metadata)The
LOCKSTEP
sync mode works as described below:DATA_CHECKOUT
key is present.DATA_CHECKOUT
key.DATA_UPDATE
key.DATA_UPDATE
key is present, the user's data will be set from the snapshot deserialized from Redis contained within that key.DATA_UPDATE
key. After this key has been set, the user's currentDATA_CHECKOUT
key will be removed from Redis.Additionally, note that
DATA_CHECKOUT
keys are set with the server ID of the server which "checked out" the data (taken from theserver.yml
config file). On both shutdown and startup, the plugin will clear allDATA_CHECKOUT
keys for the current server ID (to prevent stale keys in the event of a server crash for instance)