mirror of
https://github.com/sogou/workflow.git
synced 2026-10-29 03:27:04 +08:00
move 'pre_delete_server' inside wrlock
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user