تخطَّ إلى المحتوى

Blocking DB Call In Coroutine (ARCH8043)

هذا المحتوى غير متوفر بلغتك بعد.

Key kotlin.async.blocking-db-call-in-coroutine · Severity warning · Category async

Flags JDBC / JPA blocking data access inside a suspend function that is not wrapped in withContext(Dispatchers.IO). A Kotlin repository is normally suspending and is not reported.

suspend fun load() = repo.findAll()
suspend fun load() = withContext(Dispatchers.IO) { repo.findAll() }

Run blocking data access on Dispatchers.IO, or use a suspending client (R2DBC, Room suspend DAO).