Build the coordinator HTTP client on the first request - #1815
Conversation
|
@coderabbitai review |
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. WalkthroughRetrofit now defers OkHttp client creation until the first request. Existing interceptors, retry behavior, logging, and timeout settings remain configured on the lazy client. ChangesConnection initialization
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Coordinator HTTP client creation now occurs on the first request, allowing Compose previews to render without initializing the platform client while preserving configured request behavior. No current merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit reads each line, Comment |
SDK Size Comparison 📏
|
Compose previews in Android Studio failed with NoClassDefFoundError for com/android/org/conscrypt/TrustManagerImpl as soon as the SDK was built. Layoutlib identifies itself as Dalvik, so OkHttp picks its Android platform, which needs conscrypt classes that layoutlib does not ship. The coordinator module built the OkHttp client eagerly, and the builder reads the Retrofit API during construction, so the client was created even though previews never send a request. The client is now lazy and Retrofit gets a call factory instead of the client instance.
a69f1c1 to
713f908
Compare
|



Goal
Compose previews in Android Studio fail with
NoClassDefFoundError: com/android/org/conscrypt/TrustManagerImplas soon as a preview callsStreamPreviewDataUtils.initializeStreamVideo. Layoutlib reports the VM as Dalvik, so OkHttp selects its Android platform, but layoutlib does not ship the conscrypt classes that platform needs. Previews never send a request, so the client should not be built while the SDK is constructed.Linear: AND-1501
Implementation
CoordinatorConnectionModule.httpis nowby lazy, and Retrofit usescallFactory { http.newCall(it) }instead ofclient(http). The second change is needed becauseStreamVideoBuilder.build()reads the Retrofit API during construction, which would otherwise still build the client.The other OkHttp clients (socket connections, latency probe) are created on connect or join and are not on the preview path.
This targets
develop-v2only. Ondevelopthe module also builds the coordinator socket connection eagerly with the same client, so this change alone would not fix previews there.🎨 UI Changes
None.
Testing
CallLobbypreviews render again (verified by the author).:stream-video-android-core:compileDebugKotlin,apiCheck(internal class, no API change).StreamVideoClientTest,StreamVideoClientCleanupTest,CallConnectivityMonitorTest: 38 tests green.:stream-video-android-ui-compose:verifyPaparazziDebug: 165 tests green, goldens unchanged.Summary by CodeRabbit