-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: asset upload cancellation #1288
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1288 +/- ##
=============================================
- Coverage 56.58% 55.79% -0.80%
Complexity 1010 1010
=============================================
Files 709 720 +11
Lines 18666 19022 +356
Branches 1794 1822 +28
=============================================
+ Hits 10562 10613 +51
- Misses 7413 7728 +315
+ Partials 691 681 -10 |
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.
Whilst the solution to observe the message visibility and cancelling the scope was pretty sweet, and managed to implement the functionality quite well, the cost of having to fork so many OkHttp classes is far too high. I am not sure if this is worth it. I'm inclined to say that it isn't.
Every time we want to upgrade its version, we would need to manually bring changes to our side.
I'm diving deeper into this and trying to find an alternative solution for now.
closing the ticket for the sake of Jetbrains PR solving it 🔥 |
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
It looks like somehow Ktor is not doing well with cancellation of request bodies that require some writing to ByteChannel's. The problem seems to be Ktor not working well with CancelationException
In the stacktrace, you can see, where the crash is coming from :
It looks like, when building the request, Ktor lets any other exception up to thread handler expect of IOException()
The issue is also described here , probably much better than above, so refer to it :
awslabs/aws-sdk-kotlin#733
The fix is also taken almost straight from their PR.
Additional to overwriting OkHttpClientEngine in order to inject our own version of RequestBody()
We also had to do similar operation to our StreamAssetContent.kt which overrides OutgoingContent.WriteChannelContent.kt,
which is also being used for updating the asset and also could slip the CancellationException into the thread exception handler and cause our app to crash.
Dependencies (Optional)
If there are some other pull requests related to this one (e.g. new releases of frameworks), specify them here.
Needs releases with:
Testing
Test Coverage (Optional)
How to Test
Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.
Notes (Optional)
Specify here any other facts that you think are important for this issue.
Attachments (Optional)
Attachments like images, videos, etc. (drag and drop in the text box)
PR Post Submission Checklist for internal contributors (Optional)
PR Post Merge Checklist for internal contributors
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764
.