@@ -18,9 +18,14 @@ public IPingResponse Ping(Func<PingDescriptor, PingDescriptor> pingSelector = nu
1818 pingSelector = pingSelector ?? ( s => s ) ;
1919 return this . Dispatch < PingDescriptor , PingRequestParameters , PingResponse > (
2020 pingSelector ,
21- ( p , d ) => this . RawDispatch . PingDispatch < PingResponse > (
22- p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
23- )
21+ ( p , d ) =>
22+ {
23+ SetRequestTimeout ( d ) ;
24+ return this . RawDispatch . PingDispatch < PingResponse > (
25+ p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
26+ ) ;
27+ }
28+
2429 ) ;
2530 }
2631
@@ -30,9 +35,13 @@ public Task<IPingResponse> PingAsync(Func<PingDescriptor, PingDescriptor> pingSe
3035 pingSelector = pingSelector ?? ( s => s ) ;
3136 return this . DispatchAsync < PingDescriptor , PingRequestParameters , PingResponse , IPingResponse > (
3237 pingSelector ,
33- ( p , d ) => this . RawDispatch . PingDispatchAsync < PingResponse > (
34- p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
35- )
38+ ( p , d ) =>
39+ {
40+ SetRequestTimeout ( d ) ;
41+ return this . RawDispatch . PingDispatchAsync < PingResponse > (
42+ p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
43+ ) ;
44+ }
3645 ) ;
3746 }
3847
@@ -41,9 +50,13 @@ public IPingResponse Ping(IPingRequest pingRequest)
4150 {
4251 return this . Dispatch < IPingRequest , PingRequestParameters , PingResponse > (
4352 pingRequest ,
44- ( p , d ) => this . RawDispatch . PingDispatch < PingResponse > (
45- p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
46- )
53+ ( p , d ) =>
54+ {
55+ SetRequestTimeout ( d ) ;
56+ return this . RawDispatch . PingDispatch < PingResponse > (
57+ p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
58+ ) ;
59+ }
4760 ) ;
4861 }
4962
@@ -52,12 +65,22 @@ public Task<IPingResponse> PingAsync(IPingRequest pingRequest)
5265 {
5366 return this . DispatchAsync < IPingRequest , PingRequestParameters , PingResponse , IPingResponse > (
5467 pingRequest ,
55- ( p , d ) => this . RawDispatch . PingDispatchAsync < PingResponse > (
56- p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
57- )
68+ ( p , d ) =>
69+ {
70+ SetRequestTimeout ( d ) ;
71+ return this . RawDispatch . PingDispatchAsync < PingResponse > (
72+ p . DeserializationState ( new PingConverter ( DeserializePingResponse ) )
73+ ) ;
74+ }
5875 ) ;
5976 }
6077
78+ private void SetRequestTimeout ( IRequest < PingRequestParameters > pingRequest )
79+ {
80+ if ( this . _connectionSettings . PingTimeout . HasValue )
81+ pingRequest . RequestConfiguration . RequestTimeout = this . _connectionSettings . PingTimeout . Value ;
82+ }
83+
6184 private PingResponse DeserializePingResponse ( IElasticsearchResponse response , Stream stream )
6285 {
6386 return new PingResponse ( response ) ;
0 commit comments