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

Perform I/O operations in the background #379

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

maginporia
Copy link

No description provided.

@nielsvanvelzen
Copy link
Owner

If I understand the SQLDelight documentation correctly the asynchronous schema option is meant for use with the Kotlin JS database driver and when you use the Android driver with Database.Schema.synchronous() it will still make everything blocking in the background. I couldn't find good documentation about it though so I might be wrong here.

@maginporia
Copy link
Author

Maybe the asynchronous schema option is not necessary, but withContext(Dispatchers.IO) is still needed, right?
SQLDelight doesn’t seem to have built-in asynchronous support like Room.

@nielsvanvelzen
Copy link
Owner

Yeah the context switching was definitely missing, and while the asynchronous schema doesn't really matter it will force us to always have an coroutine which will encourage safer code (e.g. the favoriteApp function in AppsTabViewModel was blocking). So I'll merge it for now. Thanks!

@nielsvanvelzen nielsvanvelzen merged commit 277dd41 into nielsvanvelzen:master Oct 9, 2024
1 check passed
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.

2 participants