Skip to content

Commit 4b03019

Browse files
authored
Default schedule to start timeout (#239)
1 parent a1de809 commit 4b03019

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

temporal-sdk/src/main/java/io/temporal/worker/WorkerFactoryOptions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static WorkerFactoryOptions getDefaultInstance() {
4141
private static final int DEFAULT_HOST_LOCAL_WORKFLOW_POLL_THREAD_COUNT = 5;
4242
private static final int DEFAULT_WORKFLOW_CACHE_SIZE = 600;
4343
private static final int DEFAULT_MAX_WORKFLOW_THREAD_COUNT = 600;
44+
private static final Duration DEFAULT_STICKY_SCHEDULE_TO_START_TIMEOUT = Duration.ofSeconds(5);
4445

4546
private static final WorkerFactoryOptions DEFAULT_INSTANCE;
4647

@@ -49,6 +50,7 @@ public static WorkerFactoryOptions getDefaultInstance() {
4950
}
5051

5152
public static class Builder {
53+
5254
private Duration workflowHostLocalTaskQueueScheduleToStartTimeout;
5355
private int workflowCacheSize;
5456
private int maxWorkflowThreadCount;
@@ -185,6 +187,9 @@ private WorkerFactoryOptions(
185187
!workflowHostLocalTaskQueueScheduleToStartTimeout.isNegative(),
186188
"negative workflowHostLocalTaskQueueScheduleToStartTimeoutSeconds");
187189
}
190+
if (workflowHostLocalTaskQueueScheduleToStartTimeout == null) {
191+
workflowHostLocalTaskQueueScheduleToStartTimeout = DEFAULT_STICKY_SCHEDULE_TO_START_TIMEOUT;
192+
}
188193
if (workflowInterceptors == null) {
189194
workflowInterceptors = new WorkflowInterceptor[0];
190195
}

temporal-sdk/src/test/java/io/temporal/workflow/WorkflowTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ public WorkflowStub newUntypedWorkflowStub(
325325
WorkerFactoryOptions.newBuilder()
326326
.setWorkflowInterceptors(tracer)
327327
.setActivityInterceptors(activityInterceptor)
328+
.setWorkflowHostLocalTaskQueueScheduleToStartTimeout(Duration.ZERO)
328329
.setWorkflowHostLocalTaskQueueScheduleToStartTimeout(
329330
versionTest ? Duration.ZERO : Duration.ofSeconds(10))
330331
.build();

0 commit comments

Comments
 (0)