Skip to content

Commit 5ebbcd3

Browse files
authored
fix(client): Fix ConnectionOptions.connectTimeout was not used (#954)
1 parent 808e562 commit 5ebbcd3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/client/src/connection.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as grpc from '@grpc/grpc-js';
22
import { filterNullAndUndefined, normalizeTlsConfig, TLSConfig } from '@temporalio/common/lib/internal-non-workflow';
3+
import { msOptionalToNumber } from '@temporalio/common/lib/time';
34
import { AsyncLocalStorage } from 'async_hooks';
45
import type { RPCImpl } from 'protobufjs';
56
import { isServerErrorResponse, ServiceError } from './errors';
@@ -90,7 +91,7 @@ export type ConnectionOptionsWithDefaults = Required<Omit<ConnectionOptions, 'tl
9091
export const LOCAL_TARGET = '127.0.0.1:7233';
9192

9293
function addDefaults(options: ConnectionOptions): ConnectionOptionsWithDefaults {
93-
const { channelArgs, interceptors, ...rest } = options;
94+
const { channelArgs, interceptors, connectTimeout, ...rest } = options;
9495
return {
9596
address: LOCAL_TARGET,
9697
credentials: grpc.credentials.createInsecure(),
@@ -102,7 +103,7 @@ function addDefaults(options: ConnectionOptions): ConnectionOptionsWithDefaults
102103
},
103104
interceptors: interceptors ?? [makeGrpcRetryInterceptor(defaultGrpcRetryOptions())],
104105
metadata: {},
105-
connectTimeoutMs: 10_000,
106+
connectTimeoutMs: msOptionalToNumber(connectTimeout) ?? 10_000,
106107
...filterNullAndUndefined(rest),
107108
};
108109
}

0 commit comments

Comments
 (0)