MadStudioRoblox / ProfileService

Universal session-locked savable table API
https://madstudioroblox.github.io/ProfileService/
Apache License 2.0
292 stars 157 forks source link

MetaTags don't appear to save #42

Closed Z11V1 closed 4 months ago

Z11V1 commented 5 months ago

When assigning a MetaTag to a Profile, it appears to appropriately 'save' as it can then be read through MetaTagsLatest, if it's read directly from a loaded profile. However, when viewing the same profile on the same or a different server, or after the profile has been released and then loaded later on, the index returns nil.

Rough code to demonstrate:

local LOADED_SERVER_DATA_PROFILE  = PROFILE_STORE:LoadProfileAsync("TEST")

LOADED_SERVER_DATA_PROFILE.MetaData.MetaTags["CODE"] = 123456789
LOADED_SERVER_DATA_PROFILE:Save()

wait(10)

print("Code from load profile: ", LOADED_SERVER_DATA_PROFILE.MetaData.MetaTagsLatest["CODE"]) -- Returns 123456789

local VIEWED_SERVER_DATA_PROFILE  = PROFILE_STORE:ViewProfileAsync("TEST")

print("Code from viewed profile: ", VIEWED_SERVER_DATA_PROFILE.MetaData.MetaTagsLatest["CODE"]) -- Errors - no index for that

Given the docs say that MetaTagsLatest should be what is saved to the DataStore, this should work perfectly fine.

LM-loleris commented 4 months ago

MetaTagsLatest are never set in profiles loaded trough ViewProfileAsync() because viewed profiles don't receive periodic saving. Although per documentation it would be expected that MetaTagsLatest could be present as a copy of MetaTags, your very statement that "MetaTags don't appear to save" is false and your reproduction code compares live profiles loaded with LoadProfileAsync() and read-only profiles loaded via ViewProfileAsync() WHILE also assuming that ProfileService would definetly have a save cycle within just 10 seconds.

Whether or not something is truly saved via ProfileService should be checked using :LoadProfileAsync(), setting the data, calling :Release() on that profile and then loading it again with :LoadProfileAsync() and checking the data as that would force ProfileService to dump all caches to DataStore and then load everything back up again.