move 'pre_delete_server' inside wrlock

This commit is contained in:
XieHan
2021-10-29 19:00:48 +08:00
parent 60f17f53c0
commit f7c0cfc5d3
+3 -2
View File
@@ -245,13 +245,13 @@ void WFServiceGovernance::success(RouteManager::RouteResult *result,
pthread_rwlock_wrlock(&this->rwlock);
this->recover_server_from_breaker(server);
pthread_rwlock_unlock(&this->rwlock);
if (--server->ref == 0)
{
this->pre_delete_server(server);
delete server;
}
pthread_rwlock_unlock(&this->rwlock);
this->WFNSPolicy::success(result, tracing, target);
}
@@ -271,13 +271,14 @@ void WFServiceGovernance::failed(RouteManager::RouteResult *result,
pthread_rwlock_wrlock(&this->rwlock);
if (++server->fail_count == server->params->max_fails)
this->fuse_server_to_breaker(server);
pthread_rwlock_unlock(&this->rwlock);
if (--server->ref == 0)
{
this->pre_delete_server(server);
delete server;
}
pthread_rwlock_unlock(&this->rwlock);
this->WFNSPolicy::failed(result, tracing, target);
}