Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
Move options out of function
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed May 2, 2024
1 parent c249e12 commit a4809e5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/grpc-api-client/src/GrpcApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const API_URLS: { [k: string]: string } = {
const SLEEP_TIME = 1000
const MAX_RETRIES = 4

const clientOptions = {
"grpc.keepalive_timeout_ms": 1000 * 10, // 10 seconds
"grpc.keepalive_time_ms": 1000 * 30, // 30 seconds
"grpc.enable_retries": 1,
"grpc.keepalive_permit_without_calls": 0,
} as const

export default class GrpcApiClient implements ApiClient {
grpcClient: MessageApiClient
private authCache?: AuthCache
Expand All @@ -55,16 +62,10 @@ export default class GrpcApiClient implements ApiClient {
this.apiUrl = apiUrl
this.appVersion = appVersion
this.logger = pino({ name: "GrpcApiClient" })
const grpcOptions = {
"grpc.keepalive_timeout_ms": 1000 * 10, // 10 seconds
"grpc.keepalive_time_ms": 1000 * 30, // 30 seconds
"grpc.enable_retries": 1,
"grpc.keepalive_permit_without_calls": 0,
}
this.grpcClient = new MessageApiClient(
new GrpcTransport({
host: apiUrl,
clientOptions: grpcOptions,
clientOptions,
channelCredentials: isSecure
? credentials.createSsl()
: credentials.createInsecure(),
Expand Down

0 comments on commit a4809e5

Please sign in to comment.