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

Fix currently online display hitting rate limits #30146

Merged
merged 6 commits into from
Oct 22, 2024

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Oct 8, 2024

RFC. Closes #29982.

Uses the endpoint exposed in ppy/osu-web#11506. The nitty-gritty here is that GET /users?ids=[] and GET /users/lookup?ids=[] return different sets of data, namely - the former returns rulesets_statistics. Therefore, all places that use that field must continue to use the former endpoint, and the rest can switch.

As it turns out all consumers of UserLookupCache but one - multiplayer - can be switched seemingly seamlessly, but multiplayer must continue to use the former request because rulesets_statistics is required for displaying the user ranks in the participants display.

As I understand the difference in behaviour of the two endpoints here is not negotiable on the web side because rulesets_statistics is expensive and most of the reason why the old endpoint is rate-limited this harshly, although I could be wrong about that (@ppy/team-web confirmation would be appreciated).

I tested this somewhat well, but it's still a bit of a squeaky bum change because APIUser is an awful grab-bag class that contains probably like a hundred properties, half of which could be empty in any given context, so it's not easy to cross-check that some place is using a field that will now be missing after switching the endpoints.

bdach added 4 commits October 8, 2024 14:05
Doing this alleviates ppy#29982, as the
currently online display utilises the user lookup cache, and currently
is hitting rate limits due to the amount of data retrieved from the `GET
/users` endpoint. Switching to `GET /users/lookup` reduces the chance of
this happening.
After switching `UserLookupCache` to `GET /users/lookup` from `GET
/users`, multiplayer sort of breaks, since the former endpoint does not
return `ruleset_statistics`, which are used in multiplayer to show
users' ranks. Therefore, switch multiplayer to use the appropriate
request type directly.
@nanaya
Copy link

nanaya commented Oct 8, 2024

it's probably a bit too harsh at the moment but yeah it's 4-6 additional queries compared to the lookup one.

@peppy peppy self-requested a review October 22, 2024 09:36
@peppy
Copy link
Member

peppy commented Oct 22, 2024

@bdach please double-check 187fa5e, looks good otherwise.

@bdach
Copy link
Collaborator Author

bdach commented Oct 22, 2024

@bdach please double-check 187fa5e,

Bit weird that I did that 😅 Looks pretty obviously correct.

@peppy peppy merged commit c15490e into ppy:master Oct 22, 2024
9 checks passed
@bdach bdach deleted the lookup-users-endpoint branch October 22, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Currently online display requests all currently online users from API, thus eventually exceeding rate limits
3 participants