Skip to content

Lock user stats/grades for update#126

Merged
richardscull merged 9 commits into
version/0.2.0from
feat/lock-userstats-and-grades-for-update
Jun 14, 2026
Merged

Lock user stats/grades for update#126
richardscull merged 9 commits into
version/0.2.0from
feat/lock-userstats-and-grades-for-update

Conversation

@richardscull

@richardscull richardscull commented Jun 14, 2026

Copy link
Copy Markdown
Member

In this PR we are going to add lock for user stats and grades during score processing. As both entries are doing increments/decrements, we need to make sure the entities being updates are up-to-date.

I originally wanted to use atomic updates, but in MySQL database there is no good way to update entity and fetch new results as a single query. Another problem is that you can't ask EF Core to handle the atomic update itself, so you need to provide the delta values to the new method, which looks very sloppy.

As per my assumption, any score processing update will be blocked by the beatmap retrieval. Si using lock here wouldn't hurt the performance in general.

Another changes:

  • I've rolled back the new split implementation of tests workflow, since it wasn't really running the tests. bruh.
  • We now apply redis leaderboard update only after the db transaction commit.
  • Early return for the grades processor, if grades are equal for the promoted/demoted score and updated score.

@richardscull richardscull self-assigned this Jun 14, 2026
@richardscull richardscull merged commit 2186232 into version/0.2.0 Jun 14, 2026
16 checks passed
@richardscull richardscull deleted the feat/lock-userstats-and-grades-for-update branch June 14, 2026 13:08
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