Skip to content

Commit 24dd269

Browse files
committed
Remove listener.cancel from RestateServerCall::close
Calling listener.cancel is problematic in the Kotlin case because it terminates the Kotlin coroutine via an exception which will be caught and triggers outputting the ErrorMessage.
1 parent 54f0ce3 commit 24dd269

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sdk-core/src/main/java/dev/restate/sdk/core/RestateServerCall.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ public void sendMessage(MessageLite message) {
8989

9090
@Override
9191
public void close(Status status, Metadata trailers) {
92+
// Let's close the listener first
93+
listener.close();
94+
9295
if (status.isOk() || Util.containsSuspendedException(status.getCause())) {
93-
listener.close();
9496
syscalls.close();
9597
} else {
96-
// Let's cancel the listener first
97-
listener.cancel();
98-
9998
if (Util.isTerminalException(status.getCause())) {
10099
syscalls.writeOutput(
101100
(TerminalException) status.getCause(),

0 commit comments

Comments
 (0)