From 6f0cf07efcbd339b5899883fbd00c0578b548c6a Mon Sep 17 00:00:00 2001 From: pdoerner <122412190+pdoerner@users.noreply.github.com> Date: Tue, 17 Sep 2024 09:20:17 -0700 Subject: [PATCH] Fix timeout during operation retry (#2221) --- .../io/temporal/internal/testservice/StateMachines.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/temporal-test-server/src/main/java/io/temporal/internal/testservice/StateMachines.java b/temporal-test-server/src/main/java/io/temporal/internal/testservice/StateMachines.java index a2dbaa680..f3c639f9c 100644 --- a/temporal-test-server/src/main/java/io/temporal/internal/testservice/StateMachines.java +++ b/temporal-test-server/src/main/java/io/temporal/internal/testservice/StateMachines.java @@ -789,7 +789,12 @@ private static void timeoutNexusOperation( private static State failNexusOperation( RequestContext ctx, NexusOperationData data, Failure failure, long notUsed) { RetryState retryState = attemptNexusOperationRetry(ctx, Optional.of(failure), data); - if (retryState == RetryState.RETRY_STATE_IN_PROGRESS) { + if (retryState == RetryState.RETRY_STATE_IN_PROGRESS + || retryState == RetryState.RETRY_STATE_TIMEOUT) { + // RETRY_STATE_TIMEOUT indicates that the next attempt schedule time would exceed the + // operation's schedule-to-close timeout, so do not fail the operation here and allow + // it to be timed out by the timer set in + // io.temporal.internal.testservice.TestWorkflowMutableStateImpl.timeoutNexusOperation return (Strings.isNullOrEmpty(data.operationId)) ? INITIATED : STARTED; }