chore: code optimization
This commit is contained in:
parent
3cd9f67ab3
commit
2124ef00a7
|
@ -617,7 +617,7 @@ int32_t hbGetExpiredUserInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, S
|
||||||
if (userNum <= 0) {
|
if (userNum <= 0) {
|
||||||
taosMemoryFree(users);
|
taosMemoryFree(users);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < userNum; ++i) {
|
for (int32_t i = 0; i < userNum; ++i) {
|
||||||
SUserAuthVersion *user = &users[i];
|
SUserAuthVersion *user = &users[i];
|
||||||
|
@ -783,6 +783,7 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++hbParam->reqCnt; // success to get catalog info
|
++hbParam->reqCnt; // success to get catalog info
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -811,7 +812,7 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
SHbParam param = {.pAppHbMgr = pAppHbMgr};
|
SHbParam param = {0};
|
||||||
while ((pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter))) {
|
while ((pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter))) {
|
||||||
SClientHbReq *pOneReq = pIter;
|
SClientHbReq *pOneReq = pIter;
|
||||||
SClientHbKey *connKey = &pOneReq->connKey;
|
SClientHbKey *connKey = &pOneReq->connKey;
|
||||||
|
@ -828,6 +829,7 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
|
||||||
if (param.clusterId == 0) {
|
if (param.clusterId == 0) {
|
||||||
// init
|
// init
|
||||||
param.clusterId = pOneReq->clusterId;
|
param.clusterId = pOneReq->clusterId;
|
||||||
|
param.pAppHbMgr = pAppHbMgr;
|
||||||
param.connHbFlag = atomic_load_8(&pAppHbMgr->connHbFlag);
|
param.connHbFlag = atomic_load_8(&pAppHbMgr->connHbFlag);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -977,6 +979,7 @@ static void *hbThreadFunc(void *param) {
|
||||||
|
|
||||||
taosMsleep(HEARTBEAT_INTERVAL);
|
taosMsleep(HEARTBEAT_INTERVAL);
|
||||||
}
|
}
|
||||||
|
taosHashCleanup(clientHbMgr.appHbHash);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,11 +1091,6 @@ void appHbMgrCleanup(void) {
|
||||||
if (pTarget == NULL) continue;
|
if (pTarget == NULL) continue;
|
||||||
hbFreeAppHbMgr(pTarget);
|
hbFreeAppHbMgr(pTarget);
|
||||||
}
|
}
|
||||||
clientHbMgr.appHbMgrs = taosArrayDestroy(clientHbMgr.appHbMgrs);
|
|
||||||
taosHashCleanup(clientHbMgr.appSummary);
|
|
||||||
taosHashCleanup(clientHbMgr.appHbHash);
|
|
||||||
clientHbMgr.appSummary = NULL;
|
|
||||||
clientHbMgr.appHbHash = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int hbMgrInit() {
|
int hbMgrInit() {
|
||||||
|
@ -1146,7 +1144,9 @@ void hbMgrCleanUp() {
|
||||||
|
|
||||||
taosThreadMutexLock(&clientHbMgr.lock);
|
taosThreadMutexLock(&clientHbMgr.lock);
|
||||||
appHbMgrCleanup();
|
appHbMgrCleanup();
|
||||||
|
taosArrayDestroy(clientHbMgr.appHbMgrs);
|
||||||
taosThreadMutexUnlock(&clientHbMgr.lock);
|
taosThreadMutexUnlock(&clientHbMgr.lock);
|
||||||
|
clientHbMgr.appHbMgrs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, int64_t clusterId) {
|
int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, int64_t clusterId) {
|
||||||
|
|
Loading…
Reference in New Issue