@@ -169,8 +169,9 @@ static METASTORE_GRPC_CLIENT_METRICS_LAYER: Lazy<GrpcMetricsLayer> =
169169static METASTORE_GRPC_SERVER_METRICS_LAYER : Lazy < GrpcMetricsLayer > =
170170 Lazy :: new ( || GrpcMetricsLayer :: new ( "metastore" , "server" ) ) ;
171171
172- static GRPC_TIMEOUT_LAYER : Lazy < TimeoutLayer > =
173- Lazy :: new ( || TimeoutLayer :: new ( Duration :: from_secs ( 30 ) ) ) ;
172+ static GRPC_INGESTER_SERVICE_TIMEOUT : Duration = Duration :: from_secs ( 30 ) ;
173+ static GRPC_INDEXING_SERVICE_TIMEOUT : Duration = Duration :: from_secs ( 30 ) ;
174+ static GRPC_METASTORE_SERVICE_TIMEOUT : Duration = Duration :: from_secs ( 10 ) ;
174175
175176struct QuickwitServices {
176177 pub node_config : Arc < NodeConfig > ,
@@ -459,16 +460,13 @@ pub async fn serve_quickwit(
459460 {
460461 bail ! ( "could not find any metastore node in the cluster" ) ;
461462 }
462- // These layers applies to all the RPCs of the metastore.
463- let shared_layers = ServiceBuilder :: new ( )
464- . layer ( RetryLayer :: new ( RetryPolicy :: from ( RetryParams :: standard ( ) ) ) )
465- . layer ( METASTORE_GRPC_CLIENT_METRICS_LAYER . clone ( ) )
466- . layer ( tower:: limit:: GlobalConcurrencyLimitLayer :: new (
463+ MetastoreServiceClient :: tower ( )
464+ . stack_layer ( TimeoutLayer :: new ( GRPC_METASTORE_SERVICE_TIMEOUT ) )
465+ . stack_layer ( RetryLayer :: new ( RetryPolicy :: from ( RetryParams :: standard ( ) ) ) )
466+ . stack_layer ( METASTORE_GRPC_CLIENT_METRICS_LAYER . clone ( ) )
467+ . stack_layer ( tower:: limit:: GlobalConcurrencyLimitLayer :: new (
467468 get_metastore_client_max_concurrency ( ) ,
468469 ) )
469- . into_inner ( ) ;
470- MetastoreServiceClient :: tower ( )
471- . stack_layer ( shared_layers)
472470 . build_from_balance_channel ( balance_channel, grpc_config. max_message_size )
473471 } ;
474472 // Instantiate a control plane server if the `control-plane` role is enabled on the node.
@@ -514,11 +512,11 @@ pub async fn serve_quickwit(
514512 None
515513 } ;
516514
517- // Setup indexer pool.
515+ // Setup the indexer pool to track cluster changes .
518516 setup_indexer_pool (
519517 & node_config,
520518 cluster. change_stream ( ) ,
521- indexer_pool. clone ( ) ,
519+ indexer_pool,
522520 indexing_service_opt. clone ( ) ,
523521 ) ;
524522
@@ -943,7 +941,7 @@ async fn setup_ingest_v2(
943941 } else {
944942 let ingester_service = IngesterServiceClient :: tower ( )
945943 . stack_layer ( INGEST_GRPC_CLIENT_METRICS_LAYER . clone ( ) )
946- . stack_layer ( GRPC_TIMEOUT_LAYER . clone ( ) )
944+ . stack_layer ( TimeoutLayer :: new ( GRPC_INGESTER_SERVICE_TIMEOUT ) )
947945 . build_from_channel (
948946 node. grpc_advertise_addr ( ) ,
949947 node. channel ( ) ,
@@ -1145,7 +1143,7 @@ fn setup_indexer_pool(
11451143 } else {
11461144 let client = IndexingServiceClient :: tower ( )
11471145 . stack_layer ( INDEXING_GRPC_CLIENT_METRICS_LAYER . clone ( ) )
1148- . stack_layer ( GRPC_TIMEOUT_LAYER . clone ( ) )
1146+ . stack_layer ( TimeoutLayer :: new ( GRPC_INDEXING_SERVICE_TIMEOUT ) )
11491147 . build_from_channel (
11501148 node. grpc_advertise_addr ( ) ,
11511149 node. channel ( ) ,
0 commit comments