File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import type Participant from '../participant/Participant';
1313import { Future , compareVersions } from '../utils' ;
1414import type { ByteStreamReader } from '../data-stream/incoming/StreamReader' ;
1515import {
16- COMPRESS_MIN_BYTES ,
1716 DATA_STREAM_MIN_BYTES ,
1817 MAX_LEGACY_PAYLOAD_BYTES ,
1918 type PerformRpcParams ,
@@ -157,7 +156,7 @@ export default class RpcClientManager {
157156 const payloadBytes = byteLength ( payload ) ;
158157
159158 let mode : 'regular' | 'compressed' | 'compressed-data-stream' = 'regular' ;
160- if ( remoteClientProtocol >= CLIENT_PROTOCOL_GZIP_RPC && payloadBytes > COMPRESS_MIN_BYTES ) {
159+ if ( remoteClientProtocol >= CLIENT_PROTOCOL_GZIP_RPC ) {
161160 mode = 'compressed' ;
162161 }
163162 if ( mode === 'compressed' && payloadBytes > DATA_STREAM_MIN_BYTES ) {
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import type { ByteStreamReader } from '../data-stream/incoming/StreamReader';
88import type OutgoingDataStreamManager from '../data-stream/outgoing/OutgoingDataStreamManager' ;
99import type Participant from '../participant/Participant' ;
1010import {
11- COMPRESS_MIN_BYTES ,
1211 DATA_STREAM_MIN_BYTES ,
1312 MAX_LEGACY_PAYLOAD_BYTES ,
1413 RPC_DATA_STREAM_TOPIC ,
@@ -178,11 +177,8 @@ export default class RpcServerManager {
178177 }
179178
180179 // Medium response: compress inline
181- if (
182- callerClientProtocol >= CLIENT_PROTOCOL_GZIP_RPC &&
183- responseBytes > COMPRESS_MIN_BYTES
184- ) {
185- const compressed = await gzipCompress ( response ! ) ;
180+ if ( callerClientProtocol >= CLIENT_PROTOCOL_GZIP_RPC ) {
181+ const compressed = await gzipCompress ( response ) ;
186182 await this . engine . publishRpcResponseCompressed ( callerIdentity , requestId , compressed ) ;
187183 return ;
188184 }
@@ -299,10 +295,7 @@ export default class RpcServerManager {
299295 return ;
300296 }
301297
302- if (
303- callerClientProtocol >= CLIENT_PROTOCOL_GZIP_RPC &&
304- responseBytes > COMPRESS_MIN_BYTES
305- ) {
298+ if ( callerClientProtocol >= CLIENT_PROTOCOL_GZIP_RPC ) {
306299 // Medium response: compress inline
307300 const compressed = await gzipCompress ( response ) ;
308301 await this . engine . publishRpcResponseCompressed ( callerIdentity , requestId , compressed ) ;
Original file line number Diff line number Diff line change @@ -139,20 +139,16 @@ export class RpcError extends Error {
139139}
140140
141141/*
142- * Maximum payload size for RPC requests and responses when using the legacy (uncompressed / no data
143- * streams) path. If a payload exceeds this size and the remote client does not support compression,
142+ * Maximum payload size for RPC requests and responses for clients with a clientProtocol of less
143+ * than CLIENT_PROTOCOL_GZIP_RPC.
144+ *
145+ * If a payload exceeds this size and the remote client does not support compression,
144146 * the RPC call will fail with a REQUEST_PAYLOAD_TOO_LARGE(1402) or RESPONSE_PAYLOAD_TOO_LARGE(1504) error.
145147 */
146148export const MAX_LEGACY_PAYLOAD_BYTES = 15360 ; // 15 KB
147149
148150/**
149- * Payloads smaller than this are sent uncompressed (legacy path).
150- * @internal
151- */
152- export const COMPRESS_MIN_BYTES = 1024 ; // 1 KB
153-
154- /**
155- * Payloads at or above this size are sent via a data stream instead of inline.
151+ * Payloads above this size are sent via a data stream instead of inline.
156152 * @internal
157153 */
158154export const DATA_STREAM_MIN_BYTES = 15360 ; // 15 KB
@@ -163,7 +159,6 @@ export const DATA_STREAM_MIN_BYTES = 15360; // 15 KB
163159 */
164160export const RPC_REQUEST_ID_ATTR = 'lk.rpc_request_id' ;
165161
166-
167162/** @internal */
168163export const RPC_REQUEST_METHOD_ATTR = 'lk.rpc_request_method' ;
169164
You can’t perform that action at this time.
0 commit comments