|
|
@ -497,18 +497,15 @@ grpc_error_handle XdsResolver::XdsConfigSelector::CreateMethodConfig( |
|
|
|
if (route_action.retry_policy.has_value() && |
|
|
|
if (route_action.retry_policy.has_value() && |
|
|
|
!route_action.retry_policy->retry_on.Empty()) { |
|
|
|
!route_action.retry_policy->retry_on.Empty()) { |
|
|
|
std::vector<std::string> retry_parts; |
|
|
|
std::vector<std::string> retry_parts; |
|
|
|
const auto base_interval = |
|
|
|
|
|
|
|
route_action.retry_policy->retry_back_off.base_interval.as_timespec(); |
|
|
|
|
|
|
|
const auto max_interval = |
|
|
|
|
|
|
|
route_action.retry_policy->retry_back_off.max_interval.as_timespec(); |
|
|
|
|
|
|
|
retry_parts.push_back(absl::StrFormat( |
|
|
|
retry_parts.push_back(absl::StrFormat( |
|
|
|
"\"retryPolicy\": {\n" |
|
|
|
"\"retryPolicy\": {\n" |
|
|
|
" \"maxAttempts\": %d,\n" |
|
|
|
" \"maxAttempts\": %d,\n" |
|
|
|
" \"initialBackoff\": \"%d.%09ds\",\n" |
|
|
|
" \"initialBackoff\": \"%s\",\n" |
|
|
|
" \"maxBackoff\": \"%d.%09ds\",\n" |
|
|
|
" \"maxBackoff\": \"%s\",\n" |
|
|
|
" \"backoffMultiplier\": 2,\n", |
|
|
|
" \"backoffMultiplier\": 2,\n", |
|
|
|
route_action.retry_policy->num_retries + 1, base_interval.tv_sec, |
|
|
|
route_action.retry_policy->num_retries + 1, |
|
|
|
base_interval.tv_nsec, max_interval.tv_sec, max_interval.tv_nsec)); |
|
|
|
route_action.retry_policy->retry_back_off.base_interval.ToJsonString(), |
|
|
|
|
|
|
|
route_action.retry_policy->retry_back_off.max_interval.ToJsonString())); |
|
|
|
std::vector<std::string> code_parts; |
|
|
|
std::vector<std::string> code_parts; |
|
|
|
if (route_action.retry_policy->retry_on.Contains(GRPC_STATUS_CANCELLED)) { |
|
|
|
if (route_action.retry_policy->retry_on.Contains(GRPC_STATUS_CANCELLED)) { |
|
|
|
code_parts.push_back(" \"CANCELLED\""); |
|
|
|
code_parts.push_back(" \"CANCELLED\""); |
|
|
@ -536,9 +533,9 @@ grpc_error_handle XdsResolver::XdsConfigSelector::CreateMethodConfig( |
|
|
|
// Set timeout.
|
|
|
|
// Set timeout.
|
|
|
|
if (route_action.max_stream_duration.has_value() && |
|
|
|
if (route_action.max_stream_duration.has_value() && |
|
|
|
(route_action.max_stream_duration != Duration::Zero())) { |
|
|
|
(route_action.max_stream_duration != Duration::Zero())) { |
|
|
|
gpr_timespec ts = route_action.max_stream_duration->as_timespec(); |
|
|
|
fields.emplace_back( |
|
|
|
fields.emplace_back(absl::StrFormat(" \"timeout\": \"%d.%09ds\"", |
|
|
|
absl::StrFormat(" \"timeout\": \"%s\"", |
|
|
|
ts.tv_sec, ts.tv_nsec)); |
|
|
|
route_action.max_stream_duration->ToJsonString())); |
|
|
|
} |
|
|
|
} |
|
|
|
// Handle xDS HTTP filters.
|
|
|
|
// Handle xDS HTTP filters.
|
|
|
|
XdsRouting::GeneratePerHttpFilterConfigsResult result = |
|
|
|
XdsRouting::GeneratePerHttpFilterConfigsResult result = |
|
|
|