Skip to content

Commit

Permalink
Fix test server operation timeout (#2282)
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns authored Oct 21, 2024
1 parent ac3526b commit 301e129
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import io.temporal.workflow.*;
import io.temporal.workflow.shared.TestNexusServices;
import io.temporal.workflow.shared.TestWorkflows;
import java.time.Duration;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -65,10 +64,7 @@ public void testWorkflowOperationReplay() throws Exception {
public static class TestNexus implements TestWorkflows.TestWorkflow1 {
@Override
public String execute(String input) {
NexusOperationOptions options =
NexusOperationOptions.newBuilder()
.setScheduleToCloseTimeout(Duration.ofSeconds(10))
.build();
NexusOperationOptions options = NexusOperationOptions.newBuilder().build();
NexusServiceOptions serviceOptions =
NexusServiceOptions.newBuilder()
.setEndpoint(getEndpointName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ private static void scheduleNexusOperation(
long workflowTaskCompletedId) {
Duration expirationInterval = attr.getScheduleToCloseTimeout();
Timestamp expirationTime =
(attr.hasScheduleToCloseTimeout())
(attr.hasScheduleToCloseTimeout()
&& Durations.toMillis(attr.getScheduleToCloseTimeout()) > 0)
? Timestamps.add(ctx.currentTime(), expirationInterval)
: Timestamp.getDefaultInstance();
TestServiceRetryState retryState = new TestServiceRetryState(data.retryPolicy, expirationTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@ private void processScheduleNexusOperation(
timeoutNexusRequest(
scheduleEventId, "StartNexusOperation", operation.getData().getAttempt()),
"StartNexusOperation request timeout");
if (attr.hasScheduleToCloseTimeout()) {
if (attr.hasScheduleToCloseTimeout()
&& Durations.toMillis(attr.getScheduleToCloseTimeout()) > 0) {
ctx.addTimer(
ProtobufTimeUtils.toJavaDuration(attr.getScheduleToCloseTimeout()),
() ->
Expand Down

0 comments on commit 301e129

Please sign in to comment.