Skip to content

Commit 6545adb

Browse files
authored
Increase RPC timeout for list archived workflow API (#449)
1 parent e6872b9 commit 6545adb

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ target
99
/out
1010
dummy
1111
$buildDir
12-
src/main/idls/*
12+
src/main/idls/*
13+
/bin
14+
.classpath
15+
.project
16+
.settings

src/main/java/com/uber/cadence/internal/sync/TestActivityEnvironmentInternal.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,9 @@ public void ListWorkflowExecutions(
726726
@Override
727727
public void ListArchivedWorkflowExecutions(
728728
ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
729-
throws TException {}
729+
throws TException {
730+
impl.ListArchivedWorkflowExecutions(listRequest, resultHandler);
731+
}
730732

731733
@Override
732734
public void ScanWorkflowExecutions(

src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,9 @@ public void ListWorkflowExecutions(
578578
@Override
579579
public void ListArchivedWorkflowExecutions(
580580
ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
581-
throws TException {}
581+
throws TException {
582+
impl.ListArchivedWorkflowExecutions(listRequest, resultHandler);
583+
}
582584

583585
@Override
584586
public void ScanWorkflowExecutions(

src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ public class WorkflowServiceTChannel implements IWorkflowService {
128128
private static final long DEFAULT_POLL_RPC_TIMEOUT_MILLIS = 121 * 1000;
129129

130130
/** Default RPC timeout for QueryWorkflow */
131-
private static final long DEFAULT_QUERY_RPC_TIMEOUT_MILLIS = 10000;
131+
private static final long DEFAULT_QUERY_RPC_TIMEOUT_MILLIS = 10 * 1000;
132+
133+
/** Default RPC timeout for ListArchivedWorkflow */
134+
private static final long DEFAULT_LIST_ARCHIVED_WORKFLOW_TIMEOUT_MILLIS = 180 * 1000;
132135

133136
private static final String DEFAULT_CLIENT_APP_NAME = "cadence-client";
134137

@@ -148,6 +151,9 @@ public static class ClientOptions {
148151
/** The tChannel timeout for query workflow call in milliseconds */
149152
private final long rpcQueryTimeoutMillis;
150153

154+
/** The tChannel timeout for list archived workflow call in milliseconds */
155+
private final long rpcListArchivedWorkflowTimeoutMillis;
156+
151157
/** TChannel service name that the Cadence service was started with. */
152158
private final String serviceName;
153159

@@ -177,6 +183,7 @@ private ClientOptions(Builder builder) {
177183
}
178184
this.rpcLongPollTimeoutMillis = builder.rpcLongPollTimeoutMillis;
179185
this.rpcQueryTimeoutMillis = builder.rpcQueryTimeoutMillis;
186+
this.rpcListArchivedWorkflowTimeoutMillis = builder.rpcListArchivedWorkflowTimeoutMillis;
180187
if (builder.metricsScope == null) {
181188
builder.metricsScope = NoopScope.getInstance();
182189
}
@@ -209,6 +216,11 @@ public long getRpcQueryTimeoutMillis() {
209216
return rpcQueryTimeoutMillis;
210217
}
211218

219+
/** @return Returns the rpc timout for list archived workflow requests in millis. */
220+
public long getRpcListArchivedWorkflowTimeoutMillis() {
221+
return rpcListArchivedWorkflowTimeoutMillis;
222+
}
223+
212224
/** Returns the client application name. */
213225
public String getClientAppName() {
214226
return this.clientAppName;
@@ -242,6 +254,8 @@ public static class Builder {
242254
private long rpcTimeoutMillis = DEFAULT_RPC_TIMEOUT_MILLIS;
243255
private long rpcLongPollTimeoutMillis = DEFAULT_POLL_RPC_TIMEOUT_MILLIS;
244256
public long rpcQueryTimeoutMillis = DEFAULT_QUERY_RPC_TIMEOUT_MILLIS;
257+
public long rpcListArchivedWorkflowTimeoutMillis =
258+
DEFAULT_LIST_ARCHIVED_WORKFLOW_TIMEOUT_MILLIS;
245259
public String serviceName;
246260
private Scope metricsScope;
247261
private Map<String, String> transportHeaders;
@@ -279,6 +293,16 @@ public Builder setQueryRpcTimeout(long timeoutMillis) {
279293
return this;
280294
}
281295

296+
/**
297+
* Sets the rpc timeout value for query calls. Default is 180000.
298+
*
299+
* @param timeoutMillis timeout, in millis.
300+
*/
301+
public Builder setListArchivedWorkflowRpcTimeout(long timeoutMillis) {
302+
this.rpcListArchivedWorkflowTimeoutMillis = timeoutMillis;
303+
return this;
304+
}
305+
282306
/**
283307
* Sets the client application name.
284308
*
@@ -1717,7 +1741,8 @@ private ListArchivedWorkflowExecutionsResponse listArchivedWorkflowExecutions(
17171741
ThriftRequest<WorkflowService.ListArchivedWorkflowExecutions_args> request =
17181742
buildThriftRequest(
17191743
"ListArchivedWorkflowExecutions",
1720-
new WorkflowService.ListArchivedWorkflowExecutions_args(listRequest));
1744+
new WorkflowService.ListArchivedWorkflowExecutions_args(listRequest),
1745+
options.getRpcListArchivedWorkflowTimeoutMillis());
17211746
response = doRemoteCall(request);
17221747
WorkflowService.ListArchivedWorkflowExecutions_result result =
17231748
response.getBody(WorkflowService.ListArchivedWorkflowExecutions_result.class);
@@ -2340,7 +2365,9 @@ public void ListWorkflowExecutions(
23402365
@Override
23412366
public void ListArchivedWorkflowExecutions(
23422367
ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
2343-
throws TException {}
2368+
throws TException {
2369+
throw new UnsupportedOperationException("not implemented");
2370+
}
23442371

23452372
@Override
23462373
public void ScanWorkflowExecutions(

0 commit comments

Comments
 (0)