@@ -9,7 +9,7 @@ use temporalio_client::tonic::{
99} ;
1010use temporalio_client:: {
1111 ClientKeepAliveOptions as CoreClientKeepAliveConfig , Connection , ConnectionOptions ,
12- DnsLoadBalancingOptions , HttpConnectProxyOptions , RetryOptions ,
12+ DnsLoadBalancingOptions , GrpcCompression , HttpConnectProxyOptions , RetryOptions ,
1313} ;
1414use tracing:: warn;
1515use url:: Url ;
@@ -37,6 +37,7 @@ pub struct ClientConfig {
3737 keep_alive_config : Option < ClientKeepAliveConfig > ,
3838 http_connect_proxy_config : Option < ClientHttpConnectProxyConfig > ,
3939 dns_load_balancing_config : Option < ClientDnsLoadBalancingConfig > ,
40+ grpc_compression : String ,
4041}
4142
4243#[ derive( FromPyObject ) ]
@@ -266,6 +267,7 @@ impl ClientConfig {
266267 . keep_alive ( self . keep_alive_config . map ( Into :: into) )
267268 . maybe_http_connect_proxy ( self . http_connect_proxy_config . map ( Into :: into) )
268269 . dns_load_balancing ( dns_load_balancing)
270+ . grpc_compression ( grpc_compression_from_str ( & self . grpc_compression ) ?)
269271 . headers ( ascii_headers)
270272 . binary_headers ( binary_headers)
271273 . maybe_api_key ( self . api_key )
@@ -279,6 +281,16 @@ impl ClientConfig {
279281 }
280282}
281283
284+ fn grpc_compression_from_str ( value : & str ) -> PyResult < GrpcCompression > {
285+ match value {
286+ "none" => Ok ( GrpcCompression :: None ) ,
287+ "gzip" => Ok ( GrpcCompression :: Gzip ) ,
288+ _ => Err ( PyValueError :: new_err ( format ! (
289+ "invalid grpc_compression: {value}"
290+ ) ) ) ,
291+ }
292+ }
293+
282294impl TryFrom < ClientTlsConfig > for temporalio_client:: TlsOptions {
283295 type Error = PyErr ;
284296
0 commit comments