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 crash on calculating playlist duration when rate-changing mods are present #28572

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Jun 25, 2024

Regressed in #28399.

To reproduce, enter a playlist that has an item with a rate-changing mod (rather than create it yourself).

This is happening because APIRuleset has CreateInstance() unimplemented:

public Ruleset CreateInstance() => throw new NotImplementedException();

and only triggers when the playlist items in question originate from web.

This is why it is bad to have interface implementations throw outside of maybe mock implementations for tests. CreateInstance() is a scourge elsewhere in general, we need way less of it in the codebase (because while convenient, it's also problematic to implement in online contexts, and also expensive because reflection).

…e present

Regressed in ppy#28399.

To reproduce, enter a playlist that has an item with a rate-changing mod
(rather than create it yourself).

This is happening because `APIRuleset` has `CreateInstance()`
unimplemented:

    https://github.com/ppy/osu/blob/b4cefe0cc2fda0ab4b5af6138ee158bd32262f9a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs#L159

and only triggers when the playlist items in question originate from
web.

This is why it is bad to have interface implementations throw outside of
maybe mock implementations for tests. `CreateInstance()` is a scourge
elsewhere in general, we need way less of it in the codebase (because
while convenient, it's also problematic to implement in online contexts,
and also expensive because reflection).
@bdach bdach added type:reliability area:playlists next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! labels Jun 25, 2024
@bdach bdach requested a review from a team June 25, 2024 09:34
@ppy-sentryintegration
Copy link

Sentry issue: OSU-1CD8

@peppy peppy self-requested a review June 25, 2024 10:27
@peppy peppy merged commit a12f325 into ppy:master Jun 25, 2024
13 of 17 checks passed
@bdach bdach deleted the fix-playlist-duration-death branch June 25, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:playlists next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! size/S type:reliability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants