Skip to content
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

!Refactor(core): Statebag removal and changes #1407

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

Mycroft-Studios
Copy link
Contributor

Currently, everything flowing through xPlayer.set is being put into a statebag, aswell as all metadata , resulting in crashes.

This change is a high priority.

Currently, everything flowing through xPlayer.set is being put into a statebag, aswell as all metadata , resulting in crashes.

This change is a high priority.
@thelindat
Copy link
Contributor

please fix

@Gellipapa
Copy link
Member

@Mycroft-Studios Hi! Thanks for reporting the problem we will fix it. However, I have two questions:

Is the statebag crash because of the continuous data setup or because there is a lot of data?

I couldn't find any information anywhere that the statebag is only designed for a few tables of data.

I think that it crashes because it is setting the data continuously, so it's not the amount of statebag data but the frequency that is the problem.

How do you see this?

@thelindat
Copy link
Contributor

Statebags are not intended for large datasets. They should be kept as small as possible, with larger sets of data being broken up into multiple states if possible and absolutely required. Furthermore, statebags are synced to all clients - any private data being stored with xPlayer.set or xPlayer.setMeta is synced to everyone. This sync occurs when the data is set and when entering the player's scope.

Random unstructured unknown infinitely growing data shouldn't be set into statebags. Period. Having xPlayer.set synced is bad enough, but all metadata being on a single statebag is horrendous.

fix(esx_core): 🔨 send metadata to the client
@Gellipapa
Copy link
Member

Statebags are not intended for large datasets. They should be kept as small as possible, with larger sets of data being broken up into multiple states if possible and absolutely required. Furthermore, statebags are synced to all clients - any private data being stored with xPlayer.set or xPlayer.setMeta is synced to everyone. This sync occurs when the data is set and when entering the player's scope.

Random unstructured unknown infinitely growing data shouldn't be set into statebags. Period. Having xPlayer.set synced is bad enough, but all metadata being on a single statebag is horrendous.

Hi! I understand and accept that this was a bad implementation. Can you say the same about globalstate? Because as I looked at the implementation the statebag seems to me more stable than the GlobalState bag. What is your opinion about this?

@thelindat
Copy link
Contributor

Large data is still not good for GlobalState, and statebags will just stop syncing once they hit a certain size.

Granular updates are not possible with statebags either, so either splitting statebags up logically or using events for updating certain key-values is preferable.

@Gellipapa
Copy link
Member

@Mycroft-Studios @Arctos2win Thanks for fixed this urgent problem.

@Gellipapa Gellipapa changed the base branch from main to dev October 10, 2024 16:08
@Gellipapa Gellipapa merged commit 39af19e into esx-framework:dev Oct 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants