-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Update notification text when import is paused due to gameplay #30402
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
be5cb20
Update notification text when import is paused due to gameplay
peppy 61f0cfd
Make flow more `async` to avoid any chance of deadlocks
peppy ce86208
Merge branch 'master' into import-paused-visibility
peppy 48212df
Fix test failures due to early disposal of import stream
peppy 2afd357
Re-throw `OperationCanceledException` for consistency?
peppy ebc2cc3
Ensure cleanup tasks are run even on a cancelled / exceptioned import…
peppy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about this? Won't this be logged (to the user also) as an unobserved exception? I mean... see the try-catch below which even swallows the
OperationCanceledException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
pauseIfNecessaryAsync
method also throws and will likely do the same thing too outside of theForEachAsync
here (maybe a reproduction for that is enter gameplay, start import from stable, then cancel the notification?).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely doesn't come up as an unobserved else I would have noticed.
You can test using:
Debugging through I see a
TaskCanceledException
but it gracefully handles somewhere (debugger doesn't let me see). But maybe there's a scenario where that's not the case? I couldn't find one.Using
ThrowIfCancellationRequested
is recommended way to handle this, so I'd be inclined to add a catch somewhere if it's required, rather than change the calls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is causing an issue with your diff. When you cancel the notification the download/download buttons (in beatmap listing) remain active in an "importing" state, with no way to restore.
osu/osu.Game/Database/ModelDownloader.cs
Lines 67 to 84 in 5276f77
I'm seeing nothing special about what's happening here, it just looks like
OperationCanceledException
s are never unobserved / don't reach that handler. ThrowingInvalidOperationException
works, throwingOperationCanceledException
doesn't 😅Also, it's actually even caused by just passing into the
Parallel.ForEachAsync()
itself without throwing from inside the callback delegate...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved all the "clean up" actions in this flow to use
try-finally
for safety. Seems to work as expected now.