Closed WalshyDev closed 7 months ago
Your Pull Request was automatically labelled as: "🧹 Chores" Thank you for contributing to this project! ❤️
A Slimefun preview build is available for testing! Commit: 5f6706bf
https://preview-builds.walshy.dev/download/Slimefun/4119/5f6706bf
Note: This is not a supported build and is only here for the purposes of testing. Do not run this on a live server and do not report bugs anywhere but this PR!
I tested a basic profile with just researches and with research + backpacks (both Slimefun items and vanilla). Each one could save without issue
The SonarCloud Quality Gate passed, but some issues were introduced.
9 New issues
0 Security Hotspots
19.2% Coverage on New Code
0.0% Duplication on New Code
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