6
6
7
7
#[ macro_use]
8
8
extern crate tracing;
9
+
9
10
mod metrics;
10
11
mod raw;
11
12
mod retry;
@@ -316,6 +317,7 @@ impl<C> Deref for ConfiguredClient<C> {
316
317
& self . client
317
318
}
318
319
}
320
+
319
321
impl < C > DerefMut for ConfiguredClient < C > {
320
322
fn deref_mut ( & mut self ) -> & mut Self :: Target {
321
323
& mut self . client
@@ -493,6 +495,19 @@ pub struct TemporalServiceClient<T> {
493
495
test_svc_client : OnceCell < TestServiceClient < T > > ,
494
496
health_svc_client : OnceCell < HealthClient < T > > ,
495
497
}
498
+
499
+ /// We up the limit on incoming messages from server from the 4Mb default to 128Mb. If for
500
+ /// whatever reason this needs to be changed by the user, we support overriding it via env var.
501
+ fn get_decode_max_size ( ) -> usize {
502
+ static _DECODE_MAX_SIZE: OnceCell < usize > = OnceCell :: new ( ) ;
503
+ * _DECODE_MAX_SIZE. get_or_init ( || {
504
+ std:: env:: var ( "TEMPORAL_MAX_INCOMING_GRPC_BYTES" )
505
+ . ok ( )
506
+ . and_then ( |s| s. parse ( ) . ok ( ) )
507
+ . unwrap_or ( 128 * 1024 * 1024 )
508
+ } )
509
+ }
510
+
496
511
impl < T > TemporalServiceClient < T >
497
512
where
498
513
T : Clone ,
@@ -512,23 +527,30 @@ where
512
527
}
513
528
/// Get the underlying workflow service client
514
529
pub fn workflow_svc ( & self ) -> & WorkflowServiceClient < T > {
515
- self . workflow_svc_client
516
- . get_or_init ( || WorkflowServiceClient :: new ( self . svc . clone ( ) ) )
530
+ self . workflow_svc_client . get_or_init ( || {
531
+ WorkflowServiceClient :: new ( self . svc . clone ( ) )
532
+ . max_decoding_message_size ( get_decode_max_size ( ) )
533
+ } )
517
534
}
518
535
/// Get the underlying operator service client
519
536
pub fn operator_svc ( & self ) -> & OperatorServiceClient < T > {
520
- self . operator_svc_client
521
- . get_or_init ( || OperatorServiceClient :: new ( self . svc . clone ( ) ) )
537
+ self . operator_svc_client . get_or_init ( || {
538
+ OperatorServiceClient :: new ( self . svc . clone ( ) )
539
+ . max_decoding_message_size ( get_decode_max_size ( ) )
540
+ } )
522
541
}
523
542
/// Get the underlying test service client
524
543
pub fn test_svc ( & self ) -> & TestServiceClient < T > {
525
- self . test_svc_client
526
- . get_or_init ( || TestServiceClient :: new ( self . svc . clone ( ) ) )
544
+ self . test_svc_client . get_or_init ( || {
545
+ TestServiceClient :: new ( self . svc . clone ( ) )
546
+ . max_decoding_message_size ( get_decode_max_size ( ) )
547
+ } )
527
548
}
528
549
/// Get the underlying health service client
529
550
pub fn health_svc ( & self ) -> & HealthClient < T > {
530
- self . health_svc_client
531
- . get_or_init ( || HealthClient :: new ( self . svc . clone ( ) ) )
551
+ self . health_svc_client . get_or_init ( || {
552
+ HealthClient :: new ( self . svc . clone ( ) ) . max_decoding_message_size ( get_decode_max_size ( ) )
553
+ } )
532
554
}
533
555
/// Get the underlying workflow service client mutably
534
556
pub fn workflow_svc_mut ( & mut self ) -> & mut WorkflowServiceClient < T > {
@@ -551,6 +573,7 @@ where
551
573
self . health_svc_client . get_mut ( ) . unwrap ( )
552
574
}
553
575
}
576
+
554
577
/// A [WorkflowServiceClient] with the default interceptors attached.
555
578
pub type WorkflowServiceClientWithMetrics = WorkflowServiceClient < InterceptedMetricsSvc > ;
556
579
/// An [OperatorServiceClient] with the default interceptors attached.
@@ -1501,6 +1524,7 @@ mod sealed {
1501
1524
WorkflowClientTrait + RawClientLike < SvcType = InterceptedMetricsSvc >
1502
1525
{
1503
1526
}
1527
+
1504
1528
impl < T > WfHandleClient for T where
1505
1529
T : WorkflowClientTrait + RawClientLike < SvcType = InterceptedMetricsSvc >
1506
1530
{
@@ -1527,6 +1551,7 @@ pub trait WfClientExt: WfHandleClient + Sized + Clone {
1527
1551
)
1528
1552
}
1529
1553
}
1554
+
1530
1555
impl < T > WfClientExt for T where T : WfHandleClient + Clone + Sized { }
1531
1556
1532
1557
#[ cfg( test) ]
0 commit comments