Skip to content

Commit

Permalink
Merge pull request #78378 from maryliag/backport21.2-78294
Browse files Browse the repository at this point in the history
release-21.2: api: increase timeout of statements request for CC Console
  • Loading branch information
maryliag authored Mar 24, 2022
2 parents 1831ab7 + 386758b commit 0404196
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/ui/workspaces/cluster-ui/src/api/fetchData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@ export function toArrayBuffer(encodedRequest: Uint8Array): ArrayBuffer {
* @param ReqBuilder expects protobuf stub to encode request payload. It has to be
* class type, not instance;
* @param reqPayload is request payload object;
* @param timeout is the timeout for the request (optional),
* format is TimeoutValue (positive integer of at most 8 digits) +
* TimeoutUnit ( Hour → "H", Minute → "M", Second → "S", Millisecond → "m" ),
* e.g. "1M" (1 minute), default value "30S" (30 seconds);
**/
export const fetchData = <P extends ProtoBuilder<P>, T extends ProtoBuilder<T>>(
RespBuilder: T,
path: string,
ReqBuilder?: P,
reqPayload?: FirstConstructorParameter<P>,
timeout?: string,
): Promise<InstanceType<T>> => {
const grpcTimeout = timeout || "30S";
const params: RequestInit = {
headers: {
Accept: "application/x-protobuf",
"Content-Type": "application/x-protobuf",
"Grpc-Timeout": "30000m",
"Grpc-Timeout": grpcTimeout,
},
credentials: "same-origin",
};
Expand Down
3 changes: 3 additions & 0 deletions pkg/ui/workspaces/cluster-ui/src/api/statementsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ export const getCombinedStatements = (
return fetchData(
cockroach.server.serverpb.StatementsResponse,
`${STATEMENTS_PATH}?${queryStr}`,
null,
null,
"30M",
);
};

0 comments on commit 0404196

Please sign in to comment.