Skip to content

Commit 327f790

Browse files
committed
Optimize speed when using upstreams.
1 parent cd0d62d commit 327f790

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/nameservice/WFServiceGovernance.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,13 @@ void WFServiceGovernance::success(RouteManager::RouteResult *result,
259259
auto *v = &tracing_data->history;
260260
EndpointAddress *server = (*v)[v->size() - 1];
261261

262-
pthread_rwlock_wrlock(&this->rwlock);
263-
this->recover_server_from_breaker(server);
264-
pthread_rwlock_unlock(&this->rwlock);
262+
server->fail_count = 0;
263+
if (server->entry.list.next)
264+
{
265+
pthread_rwlock_wrlock(&this->rwlock);
266+
this->recover_server_from_breaker(server);
267+
pthread_rwlock_unlock(&this->rwlock);
268+
}
265269

266270
this->WFNSPolicy::success(result, tracing, target);
267271
}

0 commit comments

Comments
 (0)