void RoundRobinHostSelector::update_props_default_weight()

in src/host_selector/round_robin_host_selector.cc [175:192]


void RoundRobinHostSelector::update_props_default_weight(
    const std::shared_ptr<round_robin_property::RoundRobinClusterInfo>& info,
    const std::unordered_map<std::string, std::string>& props) {

    int set_weight = DEFAULT_WEIGHT;
    if (auto itr = props.find(round_robin_property::DEFAULT_WEIGHT_KEY); itr != props.end()) {      
        try {
            set_weight = convert_to_int(itr->second);
            if (set_weight < DEFAULT_WEIGHT) {
                throw std::runtime_error("Invalid default host weight.");
            }
        } catch (const std::exception& e) {
            throw std::runtime_error("Default host weight not parsable as an integer.");
        }
        info->last_default_weight_str = itr->first;
    }
    info->default_weight = set_weight;
}