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

Support configuring ApolloClient with lazily initialized Call.Factory. #5784

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

ychescale9
Copy link
Contributor

@ychescale9 ychescale9 commented Apr 8, 2024

Resolves #5775

I've tested this locally:

Eager OkHttpClient init:

image

Lazy OkHttpClient init:

image

Creation of ApolloClient no longer crates an OkHttpClient.

image

The creation of OkHttpClient is now deferred to after the "App Startup" window (by Coil ImageLoader).

Correction: the OkHttpClient is still created within the "App Startup" window, but it's done in a background thread by Coil.


The actual perf impact of using the lazy API obviously depends on each app.

@apollo-cla
Copy link

@ychescale9: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

Copy link

netlify bot commented Apr 8, 2024

👷 Deploy request for apollo-android-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b90a500

Copy link
Contributor

@BoD BoD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! This looks good!

Copy link
Contributor

@martinbonnin martinbonnin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks!

@BoD BoD merged commit cdbd984 into apollographql:main Apr 8, 2024
5 checks passed
@ychescale9 ychescale9 deleted the yc/lazy-callfactory branch April 8, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lazy version of okHttpCallFactory?
4 participants