@@ -300,14 +300,22 @@ def channel_factory(
300
300
logger .debug ("Channel options: {}" .format (options ))
301
301
302
302
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
+
304
307
root_certificates = driver_config .root_certificates
305
308
if root_certificates is None :
306
309
root_certificates = default_pem .load_default_pem ()
307
310
credentials = grpc .ssl_channel_credentials (
308
311
root_certificates , driver_config .private_key , driver_config .certificate_chain
309
312
)
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
+ )
311
319
312
320
313
321
class Connection (object ):
@@ -405,7 +413,12 @@ def future(
405
413
rpc_state , timeout , metadata = self ._prepare_call (
406
414
stub , rpc_name , request , settings
407
415
)
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
+ )
409
422
rendezvous .add_done_callback (
410
423
lambda resp_future : _on_response_callback (
411
424
rpc_state ,
@@ -443,7 +456,12 @@ def __call__(
443
456
stub , rpc_name , request , settings
444
457
)
445
458
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
+ )
447
465
_log_response (rpc_state , response )
448
466
return (
449
467
response
0 commit comments