Improve reliability of solo statistics watcher #21871
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
/users
endpoint would result in an empty response.RulesetsStatistics
may not be populated (and instead benull
). 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 NRTNeeded 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.