@@ -300,14 +300,22 @@ def channel_factory(
300300 logger .debug ("Channel options: {}" .format (options ))
301301
302302 if driver_config .root_certificates is None and not driver_config .secure_channel :
303- return channel_provider .insecure_channel (endpoint , options )
303+ return channel_provider .insecure_channel (
304+ endpoint , options , compression = getattr (driver_config , "compression" , None )
305+ )
306+
304307 root_certificates = driver_config .root_certificates
305308 if root_certificates is None :
306309 root_certificates = default_pem .load_default_pem ()
307310 credentials = grpc .ssl_channel_credentials (
308311 root_certificates , driver_config .private_key , driver_config .certificate_chain
309312 )
310- return channel_provider .secure_channel (endpoint , credentials , options )
313+ return channel_provider .secure_channel (
314+ endpoint ,
315+ credentials ,
316+ options ,
317+ compression = getattr (driver_config , "compression" , None ),
318+ )
311319
312320
313321class Connection (object ):
@@ -405,7 +413,12 @@ def future(
405413 rpc_state , timeout , metadata = self ._prepare_call (
406414 stub , rpc_name , request , settings
407415 )
408- rendezvous , result_future = rpc_state .future (request , timeout , metadata )
416+ rendezvous , result_future = rpc_state .future (
417+ request ,
418+ timeout ,
419+ metadata ,
420+ compression = getattr (settings , "compression" , None ),
421+ )
409422 rendezvous .add_done_callback (
410423 lambda resp_future : _on_response_callback (
411424 rpc_state ,
@@ -443,7 +456,12 @@ def __call__(
443456 stub , rpc_name , request , settings
444457 )
445458 try :
446- response = rpc_state (request , timeout , metadata )
459+ response = rpc_state (
460+ request ,
461+ timeout ,
462+ metadata ,
463+ compression = getattr (settings , "compression" , None ),
464+ )
447465 _log_response (rpc_state , response )
448466 return (
449467 response
0 commit comments