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

Improve reliability of solo statistics watcher #21871

Merged
merged 4 commits into from
Dec 28, 2022

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Dec 28, 2022

Grab-bag of fixes and improvements that I clumped together to reduce noise and merge conflict count. Recommend reviewing per-commit.

e9d32fc: Fix various failures in initial statistics fetch

  • If the local user is restricted, then attempting to fetch their data from the /users endpoint would result in an empty response.
  • Even if the user was successfully fetched, their RulesetsStatistics may not be populated (and instead be null). Curiously this was not picked up by static analysis until the first issue was fixed.

a0a26b1: Ignore statistics update subscriptions with invalid score ID

If score submission fails, the score will not receive a correct online ID from web, but will still be passed on to the solo statistics watcher on the results screen. This could lead to the watcher subscribing to changes with score ID equal to the default of -1. If this happened more than once, that would cause a crash due to duplicate keys in the callbacks dictionary.

04f9a35: Convert SoloResultsScreen to NRT

Needed for next commit.

3c0b8af: Allow unsubscribing from solo statistics updates

This is more of a safety item rather than actual issue. To avoid potential duplicate key in dictionary errors (and also avoid being slightly memory-leaky), allow SoloStatisticsWatcher consumers to dispose of the subscriptions they take out.

Can revert that last one on request. I think it's good to have, though, in theory.

- If the local user is restricted, then attempting to fetch their data
  from the `/users` endpoint would result in an empty response.

- Even if the user was successfully fetched, their `RulesetsStatistics`
  may not be populated (and instead be `null`). Curiously this was not
  picked up by static analysis until the first issue was fixed.

Closes ppy#21839.
If score submission fails, the score will not receive a correct online
ID from web, but will still be passed on to the solo statistics watcher
on the results screen. This could lead to the watcher subscribing to
changes with score ID equal to the default of -1. If this happened more
than once, that would cause a crash due to duplicate keys in the
`callbacks` dictionary.

Closes ppy#21837.
This is more of a safety item. To avoid potential duplicate key in
dictionary errors (and also avoid being slightly memory-leaky), allow
`SoloStatisticsWatcher` consumers to dispose of the subscriptions they
take out.
@peppy peppy merged commit ea8beff into ppy:master Dec 28, 2022
@bdach bdach deleted the solo-statistics-watcher-reliability branch December 28, 2022 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants