When using a connection pool with more than one node, a request will be retried if the call to a node throws an exception or returns a 502, 503 or 504 response.
var audit = new Auditor(() => VirtualClusterWith
.Nodes(10)
.ClientCalls(r => r.FailAlways())
.ClientCalls(r => r.OnPort(9201).SucceedAlways())
.StaticConnectionPool()
.Settings(s => s.DisablePing())
);
audit = await audit.TraceCall(
new ClientCall {
{ AuditEvent.BadResponse, 9200 },
{ AuditEvent.HealthyResponse, 9201 },
}
);
Will be treated as an error that requires retrying.
var audit = new Auditor(() => VirtualClusterWith
.Nodes(10)
.ClientCalls(r => r.FailAlways(502))
.ClientCalls(r => r.OnPort(9201).SucceedAlways())
.StaticConnectionPool()
.Settings(s => s.DisablePing())
);
audit = await audit.TraceCall(
new ClientCall {
{ AuditEvent.BadResponse, 9200 },
{ AuditEvent.HealthyResponse, 9201 },
}
);
Will be treated as an error that requires retrying.
var audit = new Auditor(() => VirtualClusterWith
.Nodes(10)
.ClientCalls(r => r.FailAlways(503))
.ClientCalls(r => r.OnPort(9201).SucceedAlways())
.StaticConnectionPool()
.Settings(s => s.DisablePing())
);
audit = await audit.TraceCall(
new ClientCall {
{ AuditEvent.BadResponse, 9200 },
{ AuditEvent.HealthyResponse, 9201 },
}
);
Will be treated as an error that requires retrying.
var audit = new Auditor(() => VirtualClusterWith
.Nodes(10)
.ClientCalls(r => r.FailAlways(504))
.ClientCalls(r => r.OnPort(9201).SucceedAlways())
.StaticConnectionPool()
.Settings(s => s.DisablePing())
);
audit = await audit.TraceCall(
new ClientCall {
{ AuditEvent.BadResponse, 9200 },
{ AuditEvent.HealthyResponse, 9201 },
}
);
If a call returns a valid HTTP status code other than 502 or 503, the request won’t be retried.
Important
|
Different requests may have different status codes that are deemed valid. For example, a 404 Not Found response is a valid status code for an index exists request. |
var audit = new Auditor(() => VirtualClusterWith
.Nodes(10)
.ClientCalls(r => r.FailAlways(418))
.ClientCalls(r => r.OnPort(9201).SucceedAlways())
.StaticConnectionPool()
.Settings(s => s.DisablePing())
);
audit = await audit.TraceCall(
new ClientCall {
{ AuditEvent.BadResponse, 9200 },
}
);