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

Launch SendMessage coroutine with CoroutineStart.UNDISPATCHED. #351

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions stub/src/main/java/io/grpc/kotlin/ClientCalls.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import io.grpc.MethodDescriptor
import io.grpc.Status
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.cancel
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.onFailure
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
Expand Down Expand Up @@ -309,7 +309,10 @@ object ClientCalls {
headers.copy()
)

val sender = launch(CoroutineName("SendMessage worker for ${method.fullMethodName}")) {
val sender = launch(
context = CoroutineName("SendMessage worker for ${method.fullMethodName}"),
start = CoroutineStart.UNDISPATCHED
) {
try {
request.sendTo(clientCall, readiness)
clientCall.halfClose()
Expand Down