File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
Elasticsearch.Net/Responses
Tests/ClientConcepts/ConnectionPooling/Failover Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ public class ElasticsearchResponse<T> : IApiCallDetails
7373 /// </summary>
7474 public bool SuccessOrKnownError =>
7575 this . Success || ( HttpStatusCode >= 400 && HttpStatusCode < 599
76+ && HttpStatusCode != 504 //Gateway timeout needs to be retried
7677 && HttpStatusCode != 503 //service unavailable needs to be retried
7778 && HttpStatusCode != 502 //bad gateway needs to be retried
7879 ) ;
Original file line number Diff line number Diff line change 1- using System ;
2- using System . Threading . Tasks ;
3- using Elasticsearch . Net ;
4- using Nest ;
1+ using System . Threading . Tasks ;
52using Tests . Framework ;
63using static Elasticsearch . Net . AuditEvent ;
74
@@ -82,6 +79,30 @@ public async Task Http503FallsOver()
8279 ) ;
8380 }
8481
82+ /**[[service-unavailable]]
83+ *=== 504 Gateway Timeout
84+ *
85+ * Will be treated as an error that requires retrying
86+ */
87+ [ U ]
88+ public async Task Http504FallsOver ( )
89+ {
90+ var audit = new Auditor ( ( ) => Framework . Cluster
91+ . Nodes ( 10 )
92+ . ClientCalls ( r => r . FailAlways ( 504 ) )
93+ . ClientCalls ( r => r . OnPort ( 9201 ) . SucceedAlways ( ) )
94+ . StaticConnectionPool ( )
95+ . Settings ( s => s . DisablePing ( ) )
96+ ) ;
97+
98+ audit = await audit . TraceCall (
99+ new ClientCall {
100+ { BadResponse , 9200 } ,
101+ { HealthyResponse , 9201 } ,
102+ }
103+ ) ;
104+ }
105+
85106 /**
86107 * If a call returns a valid http status code other than 502 or 503, the request won't be retried.
87108 *
You can’t perform that action at this time.
0 commit comments