Skip to content

Commit c77db80

Browse files
Fix poll async result
1 parent 4e3be67 commit c77db80

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,17 +419,14 @@ public void pollAsyncResult(AsyncResultInternal<?> asyncResult) {
419419

420420
private void pollAsyncResultInner(AsyncResultInternal<?> asyncResult) {
421421
while (true) {
422-
if (this.stateMachine.state() == StateMachine.InvocationState.CLOSED) {
423-
asyncResult.publicFuture().completeExceptionally(AbortedExecutionException.INSTANCE);
424-
return;
425-
}
426-
427422
// Let's start by trying to complete it
428423
try {
429424
asyncResult.tryComplete(this::takeNotification);
430425
} catch (Throwable e) {
431426
// This can happen if the state machine was closed in the meantime.
432-
failWithoutContextSwitch(e);
427+
if (!ExceptionUtils.containsAbortedExecutionException(e)) {
428+
this.failWithoutContextSwitch(e);
429+
}
433430
asyncResult.publicFuture().completeExceptionally(AbortedExecutionException.INSTANCE);
434431
return;
435432
}

0 commit comments

Comments
 (0)