-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move PlayerProfile saving off the main thread #4119
Conversation
Your Pull Request was automatically labelled as: "🧹 Chores" |
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/4119/5f6706bf
|
I tested a basic profile with just researches and with research + backpacks (both Slimefun items and vanilla). Each one could save without issue |
…tion for debug Moved the PlayerProfile saving off the main thread, we generally load this off-thread but now we also save off-thread. I thought we were already doing this but apparently not, especially with our current YAML stuff this should definitely be done Also done a small change to ensure that we don't remove the PlayerProfile from memory if the player is still online. I don't think we ever had a reported issue from this but it's kinda weird behaviour Finally, added some debug logs to the saving logic, this can be enabled with . Also added auto-complete to /sf debug because it's nice, this only works for Slimefun test cases rather than addons but that's fine. Mostly internal anyway
b3d2e4b
to
3d13adc
Compare
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't think of a case in which this would fail if the original worked so LGTM
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 9 New issues |
Description
Moves the PlayerProfile saving off the main thread
Proposed changes
Move PlayerProfile off main thread, add debugs and improve tab completion for debug
Moved the PlayerProfile saving off the main thread, we generally load this off-thread but now we also save off-thread. I thought we were already doing this but apparently not, especially with our current YAML stuff this should definitely be done
Also done a small change to ensure that we don't remove the PlayerProfile from memory if the player is still online. I don't think we ever had a reported issue from this but it's kinda weird behaviour
Finally, added some debug logs to the saving logic, this can be enabled with
/sf debug slimefun_player_profile_data
. Also added auto-complete to /sf debug because it's nice, this only works for Slimefun test cases rather than addons but that's fine. Mostly internal anywayPlease consider any cases where this will cause issues and bring them up!
I think this should be generally safe since we've been saving on-thread but loading off-thread anyway for ages but we should exercise caution. I think with the extra enforcement of the player definitely still being offline there's no issue here but give it a think before approving :)
Related Issues (if applicable)
Resolves #4118
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values