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

Ad support for RealmConfiguration.allowQueriesOnUiThread()/allowWritesOnUiThread() #576

Open
sync-by-unito bot opened this issue Nov 22, 2021 · 0 comments

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented Nov 22, 2021

Similar to Realm Java we should prevent people from making performance mistakes by querying or writing on the UI thread.

Given some KMP targets might not have a dedicated UI thread, we do need to decide what to do there:

  • Ignore these settings on e.g. JVM
  • Use Dispatchers.Main as proxy, i.e assume this dispatcher i single-threaded and verify using its Id. Unclear how this impact testing code though.
  • Naming: Should we use the concept of uiThread (which is what really matters) or mainThread (which would match us checking the Main dispatcher.

Suggested API:

RealmConfiguration.Builder.allowQueriesOnUiThread(enabled: Boolean = true) 
RealmConfiguration.Builder.allowWritesOnUiThread(enabled: Boolean = true)
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

0 participants