diff --git a/src/nameservice/WFDnsResolver.h b/src/nameservice/WFDnsResolver.h index 4584d96a..46248905 100644 --- a/src/nameservice/WFDnsResolver.h +++ b/src/nameservice/WFDnsResolver.h @@ -61,7 +61,6 @@ public: protected: virtual void dispatch(); virtual SubTask *done(); - void set_has_next() { has_next_ = true; } private: void thread_dns_callback(void *thrd_dns_task); diff --git a/src/nameservice/WFServiceGovernance.cc b/src/nameservice/WFServiceGovernance.cc index 61f2e113..5649a80e 100644 --- a/src/nameservice/WFServiceGovernance.cc +++ b/src/nameservice/WFServiceGovernance.cc @@ -144,23 +144,6 @@ void WFSGResolverTask::dispatch() return; } - if (sg_->pre_select_) - { - WFConditional *cond = sg_->pre_select_(this); - if (cond) - { - series_of(this)->push_front(cond); - this->set_has_next(); - this->subtask_done(); - return; - } - else if (this->state != WFT_STATE_UNDEFINED) - { - this->subtask_done(); - return; - } - } - if (sg_->select(ns_params_.uri, tracing, &addr)) { auto *tracing_data = (WFServiceGovernance::TracingData *)tracing->data; @@ -324,10 +307,12 @@ void WFServiceGovernance::check_breaker_locked(int64_t cur_time) void WFServiceGovernance::check_breaker() { - pthread_mutex_lock(&this->breaker_lock); if (!list_empty(&this->breaker_list)) + { + pthread_mutex_lock(&this->breaker_lock); this->check_breaker_locked(GET_CURRENT_SECOND); - pthread_mutex_unlock(&this->breaker_lock); + pthread_mutex_unlock(&this->breaker_lock); + } } void WFServiceGovernance::try_clear_breaker() diff --git a/src/nameservice/WFServiceGovernance.h b/src/nameservice/WFServiceGovernance.h index 0814b029..4c931959 100644 --- a/src/nameservice/WFServiceGovernance.h +++ b/src/nameservice/WFServiceGovernance.h @@ -25,7 +25,6 @@ #include #include #include -#include #include "URIParser.h" #include "EndpointParams.h" #include "WFNameService.h" @@ -123,14 +122,6 @@ public: static bool in_select_history(WFNSTracing *tracing, EndpointAddress *addr); -public: - using pre_select_t = std::function; - - void set_pre_select(pre_select_t pre_select) - { - pre_select_ = std::move(pre_select); - } - private: virtual bool select(const ParsedURI& uri, WFNSTracing *tracing, EndpointAddress **addr); @@ -156,7 +147,6 @@ private: struct list_head breaker_list; pthread_mutex_t breaker_lock; unsigned int mttr_seconds; - pre_select_t pre_select_; protected: virtual EndpointAddress *first_strategy(const ParsedURI& uri,