Refactor thread-blocking RxJava calls to coroutine suspending .await()#6850
Refactor thread-blocking RxJava calls to coroutine suspending .await()#6850Roniscend wants to merge 1 commit into
Conversation
0aa14c9 to
fffae7c
Compare
There was a problem hiding this comment.
Pull request overview
Refactors some thread-blocking RxJava calls in upload + Wikidata-edit flows to coroutine-friendly suspending await() calls, aiming to reduce ANR / thread-starvation risk during uploads and Wikidata edits.
Changes:
- Convert multiple
blockingGet/blockingAwait/blockingSingleusages inUploadWorkerto coroutine suspension viaawait(). - Refactor parts of
WikidataEditServiceto avoid a thread-blockingblockingFirst()by returning anObservableand composing asynchronously. - Make Wikidata claim creation APIs (
createClaim,addImageAndMediaLegends)suspendand switch claim creation toawait().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| app/src/main/java/fr/free/nrw/commons/wikidata/WikidataEditService.kt | Removes one blocking Rx call and converts claim creation to coroutine await() with suspend APIs. |
| app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt | Replaces blocking Rx calls during upload pipeline with coroutine await() and adjusts some DB update points. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b5f2ec1 to
73ce566
Compare
73ce566 to
d65ad36
Compare
|
Traced both of these through to confirm before flagging:
The three Both fixable — first probably wants something like |
Description (required)
Replaced .blockingGet(), .blockingAwait(), and .blockingSingle() with non-blocking .await() equivalents across UploadWorker and WikidataEditService
Fixes #6835
Tests performed (required)
Tested 6.4.0-debug on Pixel(Android 16)