Improper caching causing dupes for offline players
Jikoo opened this issue ยท 3 comments
This is a rare case. The Player loaded by the PlayerDataManager is a new object for SpecialEnderChest and SpecialPlayerInventory.
To replicate dupe/overwrite issues:
- Open an offline player's inventory to cache it
- Open the offline player's ender chest to cache it
- Edit both inventories
- Restart server to clear cached inventories (cached inventories only clear when players go offline - some retention policy would be good, the current state is bad)
- Reopen inventories to see whichever was closed first reverted to previous state
To fix this, I'm probably going to implement a cache system similar to Guava's - while the inventory has viewers, players will be loaded. After that there will be a brief period, probably a couple minutes, where they (and the relevant inventories) remain cached in case of a re-open.
This will also allow us to further reduce redundant saves pretty simply - saving really only needs to happen when a player is removed from the cache.
Odd, it seemed to work fine in testing, I'll look into it. I bet I accidentally removed the override on inventory size when removing redundant methods
Edit: YEP I DID AM GUD CODE, will have a fix out shortly. Only 1.10 was affected, by the looks of things.