Skip to content

Commit

Permalink
chore: run some operations on worker thread (#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohassine authored Sep 21, 2023
1 parent 613160f commit 58639ea
Showing 2 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -80,15 +80,17 @@ class ProteusClientProviderImpl(

override suspend fun getOrError(): Either<CoreFailure, ProteusClient> {
return mutex.withLock {
_proteusClient?.let { Either.Right(it) } ?: run {
if (FileUtil.isDirectoryNonEmpty(rootProteusPath)) {
wrapProteusRequest {
createProteusClient().also {
_proteusClient = it
withContext(dispatcher.io) {
_proteusClient?.let { Either.Right(it) } ?: run {
if (FileUtil.isDirectoryNonEmpty(rootProteusPath)) {
wrapProteusRequest {
createProteusClient().also {
_proteusClient = it
}
}
} else {
Either.Left(CoreFailure.MissingClientRegistration)
}
} else {
Either.Left(CoreFailure.MissingClientRegistration)
}
}
}
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ import com.wire.kalium.util.KaliumDispatcherImpl
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.withContext

/**
* This use case is responsible for answering a call.
@@ -66,10 +67,11 @@ internal class AnswerCallUseCaseImpl(
unMuteCall(conversationId)
}
}

callManager.value.answerCall(
conversationId = conversationId,
isAudioCbr = kaliumConfigs.forceConstantBitrateCalls
)
withContext(dispatchers.default) {
callManager.value.answerCall(
conversationId = conversationId,
isAudioCbr = kaliumConfigs.forceConstantBitrateCalls
)
}
}
}

0 comments on commit 58639ea

Please sign in to comment.