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

RemoteConfig - setDefaults. Does it need to be "suspend" or am I doing this wrong? #639

Open
Monabr opened this issue Sep 28, 2024 · 1 comment

Comments

@Monabr
Copy link

Monabr commented Sep 28, 2024

Hello.

In an Android project I got a RemoteConfig in classes using DI. In it I configured the RemoteConfig in the module specifying the update period and default values.

I did the same using your library. During the migration I found that the setDefaults function has now become a suspend function. At first this puzzled me a lot because functions in the DI module cannot be suspend. I solved this situation by using runBlocking.

Despite my decision to use runBlocking I still doubt this method.

  • Did I configure it correctly? Maybe I should configure it differently?
  • Will runBlocking greatly affect the application startup time?
  • Should setDefaults definitely be suspend?
  • Is it possible to do setDefaults differently without affecting the application startup time?
@mr-kew
Copy link
Contributor

mr-kew commented Oct 17, 2024

Well setDefaults is suspend because on android it uses setDefaultsAsync that returns Task. If you didnt process the Task on android, then you should use launch instead of runBlocking when using suspend to do like a fire and forget.

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

No branches or pull requests

2 participants