diff --git a/src/factory/CMakeLists.txt b/src/factory/CMakeLists.txt index 2bb2c02d..24689fa6 100644 --- a/src/factory/CMakeLists.txt +++ b/src/factory/CMakeLists.txt @@ -18,3 +18,4 @@ if (KAFKA STREQUAL "y") ) add_library("factory_kafka" OBJECT ${SRC}) endif () + diff --git a/src/nameservice/ServiceGovernance.cc b/src/nameservice/ServiceGovernance.cc index 6e61fc44..d6ae2d6d 100644 --- a/src/nameservice/ServiceGovernance.cc +++ b/src/nameservice/ServiceGovernance.cc @@ -22,16 +22,21 @@ #include "WFNameService.h" #include "WFDNSResolver.h" #include "ServiceGovernance.h" +#include "UpstreamManager.h" #define DNS_CACHE_LEVEL_1 1 #define DNS_CACHE_LEVEL_2 2 PolicyAddrParams::PolicyAddrParams() { - PolicyAddrParams(ADDRESS_PARAMS_DEFAULT); + const AddressParams *params = &ADDRESS_PARAMS_DEFAULT; + this->endpoint_params = params->endpoint_params; + this->dns_ttl_default = params->dns_ttl_default; + this->dns_ttl_min = params->dns_ttl_min; + this->max_fails = params->max_fails; } -PolicyAddrParams::PolicyAddrParams(const struct AddressParams *params) : +PolicyAddrParams::PolicyAddrParams(const AddressParams *params) : endpoint_params(params->endpoint_params) { this->dns_ttl_default = params->dns_ttl_default; @@ -214,7 +219,7 @@ void ServiceGovernance::check_breaker() } } } - pthread_mutex_unlock(&this->breaker_lock); + pthread_mutex_unlock(&this->breaker_lock); } const EndpointAddress *ServiceGovernance::first_stradegy(const ParsedURI& uri) diff --git a/src/nameservice/ServiceGovernance.h b/src/nameservice/ServiceGovernance.h index b8a55674..a87e65e2 100644 --- a/src/nameservice/ServiceGovernance.h +++ b/src/nameservice/ServiceGovernance.h @@ -17,7 +17,7 @@ */ #ifndef _SERVICE_GOVERNANCE_H_ -#define _SERVICE_GOVERNANCE_H_ +#define _SERVICE_GOVERNANCE_H_ #include #include @@ -31,7 +31,7 @@ #include "WFTaskError.h" #include "UpstreamManager.h" -#define MTTR_SECOND_DEFAULT 30 +#define MTTR_SECOND_DEFAULT 30 #define VIRTUAL_GROUP_SIZE 16 #define GET_CURRENT_SECOND std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count() @@ -53,7 +53,7 @@ public: unsigned int max_fails; PolicyAddrParams(); - PolicyAddrParams(const struct AddressParams *params); + PolicyAddrParams(const AddressParams *params); }; class EndpointAddress