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

Sync Over Async (ARCH8023)

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

Key kotlin.async.sync-over-async · Severity error · Category async

Flags runBlocking outside main functions, tests and blocking framework contracts (Interceptor.intercept) - it blocks the calling thread on a coroutine and deadlocks single-threaded dispatchers.

fun load(): User = runBlocking { repository.load() }
suspend fun load(): User = repository.load()

Make the caller suspend, or bridge at the outermost edge only (main, a test, a framework callback that offers no suspension).