1
1
import * as grpc from '@grpc/grpc-js' ;
2
2
import { filterNullAndUndefined , normalizeTlsConfig , TLSConfig } from '@temporalio/common/lib/internal-non-workflow' ;
3
+ import { msOptionalToNumber } from '@temporalio/common/lib/time' ;
3
4
import { AsyncLocalStorage } from 'async_hooks' ;
4
5
import type { RPCImpl } from 'protobufjs' ;
5
6
import { isServerErrorResponse , ServiceError } from './errors' ;
@@ -90,7 +91,7 @@ export type ConnectionOptionsWithDefaults = Required<Omit<ConnectionOptions, 'tl
90
91
export const LOCAL_TARGET = '127.0.0.1:7233' ;
91
92
92
93
function addDefaults ( options : ConnectionOptions ) : ConnectionOptionsWithDefaults {
93
- const { channelArgs, interceptors, ...rest } = options ;
94
+ const { channelArgs, interceptors, connectTimeout , ...rest } = options ;
94
95
return {
95
96
address : LOCAL_TARGET ,
96
97
credentials : grpc . credentials . createInsecure ( ) ,
@@ -102,7 +103,7 @@ function addDefaults(options: ConnectionOptions): ConnectionOptionsWithDefaults
102
103
} ,
103
104
interceptors : interceptors ?? [ makeGrpcRetryInterceptor ( defaultGrpcRetryOptions ( ) ) ] ,
104
105
metadata : { } ,
105
- connectTimeoutMs : 10_000 ,
106
+ connectTimeoutMs : msOptionalToNumber ( connectTimeout ) ?? 10_000 ,
106
107
...filterNullAndUndefined ( rest ) ,
107
108
} ;
108
109
}
0 commit comments