Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-372

Ad support for `RealmConfiguration.allowQueriesOnUiThread()/allowWritesOnUiThread()`

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Local
    • None

      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:

      Unable to find source-code formatter for language: kotlin. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      RealmConfiguration.Builder.allowQueriesOnUiThread(enabled: Boolean = true) 
      RealmConfiguration.Builder.allowWritesOnUiThread(enabled: Boolean = true)
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: