@clonegod/ttd-sui-common 1.0.100 → 1.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,6 +6,7 @@ export declare class GrpcConnection {
|
|
|
6
6
|
private metadata;
|
|
7
7
|
private constructor();
|
|
8
8
|
static getInstance(grpc_endpoint: string, grpc_token: string): GrpcConnection;
|
|
9
|
+
private static readonly CHANNEL_OPTIONS;
|
|
9
10
|
private getChannel;
|
|
10
11
|
createServiceClient<T>(protoFileName: string, serviceName: string): T;
|
|
11
12
|
getMetadata(): grpc.Metadata;
|
|
@@ -53,23 +53,7 @@ class GrpcConnection {
|
|
|
53
53
|
}
|
|
54
54
|
getChannel() {
|
|
55
55
|
if (!this.channel) {
|
|
56
|
-
this.channel = new grpc.Channel(this.endpoint, grpc.credentials.createSsl(),
|
|
57
|
-
'grpc.keepalive_time_ms': 120000,
|
|
58
|
-
'grpc.keepalive_timeout_ms': 10000,
|
|
59
|
-
'grpc.keepalive_permit_without_calls': 0,
|
|
60
|
-
'grpc.http2.max_pings_without_data': 1,
|
|
61
|
-
'grpc.http2.min_time_between_pings_ms': 120000,
|
|
62
|
-
'grpc.http2.min_ping_interval_without_data_ms': 120000,
|
|
63
|
-
'grpc.max_receive_message_length': 4 * 1024 * 1024,
|
|
64
|
-
'grpc.max_send_message_length': 4 * 1024 * 1024,
|
|
65
|
-
'grpc.initial_reconnect_backoff_ms': 1000,
|
|
66
|
-
'grpc.max_reconnect_backoff_ms': 30000,
|
|
67
|
-
'grpc.enable_retries': 1,
|
|
68
|
-
'grpc.retry_buffer_size': 256 * 1024,
|
|
69
|
-
'grpc.http2.max_frame_size': 16384,
|
|
70
|
-
'grpc.http2.max_header_list_size': 16384,
|
|
71
|
-
'grpc.http2.initial_window_size': 65535,
|
|
72
|
-
});
|
|
56
|
+
this.channel = new grpc.Channel(this.endpoint, grpc.credentials.createSsl(), GrpcConnection.CHANNEL_OPTIONS);
|
|
73
57
|
(0, dist_1.log_info)(`======> create grpc channel, endpoint= ${this.endpoint}`);
|
|
74
58
|
}
|
|
75
59
|
return this.channel;
|
|
@@ -91,9 +75,7 @@ class GrpcConnection {
|
|
|
91
75
|
throw new Error(`Service ${serviceName} not found in proto file`);
|
|
92
76
|
}
|
|
93
77
|
const channel = this.getChannel();
|
|
94
|
-
return new service(this.endpoint, grpc.credentials.createSsl(), {
|
|
95
|
-
channelOverride: channel
|
|
96
|
-
});
|
|
78
|
+
return new service(this.endpoint, grpc.credentials.createSsl(), Object.assign(Object.assign({}, GrpcConnection.CHANNEL_OPTIONS), { channelOverride: channel }));
|
|
97
79
|
}
|
|
98
80
|
getMetadata() {
|
|
99
81
|
return this.metadata;
|
|
@@ -107,3 +89,20 @@ class GrpcConnection {
|
|
|
107
89
|
}
|
|
108
90
|
}
|
|
109
91
|
exports.GrpcConnection = GrpcConnection;
|
|
92
|
+
GrpcConnection.CHANNEL_OPTIONS = {
|
|
93
|
+
'grpc.keepalive_time_ms': 60000,
|
|
94
|
+
'grpc.keepalive_timeout_ms': 10000,
|
|
95
|
+
'grpc.keepalive_permit_without_calls': 0,
|
|
96
|
+
'grpc.http2.max_pings_without_data': 0,
|
|
97
|
+
'grpc.http2.min_time_between_pings_ms': 60000,
|
|
98
|
+
'grpc.http2.min_ping_interval_without_data_ms': 60000,
|
|
99
|
+
'grpc.max_receive_message_length': 4 * 1024 * 1024,
|
|
100
|
+
'grpc.max_send_message_length': 4 * 1024 * 1024,
|
|
101
|
+
'grpc.initial_reconnect_backoff_ms': 1000,
|
|
102
|
+
'grpc.max_reconnect_backoff_ms': 30000,
|
|
103
|
+
'grpc.enable_retries': 1,
|
|
104
|
+
'grpc.retry_buffer_size': 256 * 1024,
|
|
105
|
+
'grpc.http2.max_frame_size': 16384,
|
|
106
|
+
'grpc.http2.max_header_list_size': 16384,
|
|
107
|
+
'grpc.http2.initial_window_size': 65535,
|
|
108
|
+
};
|