connectrpc / connect-kotlin

The Kotlin implementation of Connect: Protobuf RPC that works.
https://connectrpc.com/docs/kotlin/getting-started
Apache License 2.0
104 stars 17 forks source link

Update to v1.0.3 of conformance suite #318

Closed jhump closed 2 months ago

jhump commented 2 months ago

Some new test cases in the latest suite revealed errors in how cancelation of unary RPCs was implemented in the conformance client, but it only impacted the "suspend" style of invocation (callback and blocking styles worked fine).

The issue is that the coroutineScope function doesn't return until all child coroutines complete. So even though the helper was using launch to create a concurrent coroutine, the whole thing blocked until that job finished. In order to fix that, I had to move the coroutineScope call higher up the call stack (out of a helper method on the UnaryClient adapter and into the conformance Client itself), so it also made sense to move the related InvokeStyle enum.

Most of the diff is inlining that helper into the conformance client. But I also had to add an exception handler to the async job, to actually complete the future (with an exception) if the coroutine gets canceled (which is the only way we expose canceling a suspend unary RPC).