Skip to content

Improve DB efficiency of SC shop handler#55

Open
yungcomputerchair wants to merge 1 commit into
Open-Source-Free-Realms:mainfrom
yungcomputerchair:scshop
Open

Improve DB efficiency of SC shop handler#55
yungcomputerchair wants to merge 1 commit into
Open-Source-Free-Realms:mainfrom
yungcomputerchair:scshop

Conversation

@yungcomputerchair

Copy link
Copy Markdown
Contributor

SC shop purchases are currently hammering the DB with a minimum of 4 database accesses per purchase (more if it's a multi-item bundle). Not only is this inefficient but it also is prone to desync with the client if one of the saves fails.

This PR refactors the SC shop purchase code to align with the Coin Shop purchase code, which does one read from the DB to get all the character's existing data and then one write with the changes applied. All the client-facing updates are deferred until after the DB commit so that the client either gets a success or a failure for all items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant