refactor: do some internal refactor.

This commit is contained in:
Haojun Liao 2025-01-23 00:32:46 +08:00
parent 883b1b79a2
commit 989c20078a
2 changed files with 23 additions and 19 deletions

View File

@ -411,7 +411,7 @@ void mndDoTimerPullupTask(SMnode *pMnode, int64_t sec) {
mndStreamConsensusChkpt(pMnode);
}
if (sec % 20 == (TMIN(86400, (20 - 1)))) {
if (sec % tsTelemInterval == (TMIN(86400, (tsTelemInterval - 1)))) {
mndPullupTelem(pMnode);
}

View File

@ -97,32 +97,36 @@ static void mndBuildRuntimeInfo(SMnode* pMnode, SJson* pJson) {
mndRetrieveAlgoList(pMnode, pFcList, pAdList);
SJson *items = tjsonAddArrayToObject(pJson, "forecast");
TSDB_CHECK_NULL(items, code, lino, _OVER, terrno);
if (taosArrayGetSize(pFcList) > 0) {
SJson* items = tjsonAddArrayToObject(pJson, "forecast");
TSDB_CHECK_NULL(items, code, lino, _OVER, terrno);
for(int32_t i = 0; i < taosArrayGetSize(pFcList); ++i) {
SJson *item = tjsonCreateObject();
for (int32_t i = 0; i < taosArrayGetSize(pFcList); ++i) {
SJson* item = tjsonCreateObject();
TSDB_CHECK_NULL(item, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddItemToArray(items, item), &lino, _OVER);
TSDB_CHECK_NULL(item, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddItemToArray(items, item), &lino, _OVER);
SAnodeAlgo *p = taosArrayGet(pFcList, i);
TSDB_CHECK_NULL(p, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddStringToObject(item, "name", p->name), &lino, _OVER);
SAnodeAlgo* p = taosArrayGet(pFcList, i);
TSDB_CHECK_NULL(p, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddStringToObject(item, "name", p->name), &lino, _OVER);
}
}
SJson *items1 = tjsonAddArrayToObject(pJson, "anomaly_detection");
TSDB_CHECK_NULL(items1, code, lino, _OVER, terrno);
if (taosArrayGetSize(pAdList) > 0) {
SJson* items1 = tjsonAddArrayToObject(pJson, "anomaly_detection");
TSDB_CHECK_NULL(items1, code, lino, _OVER, terrno);
for(int32_t i = 0; i < taosArrayGetSize(pAdList); ++i) {
SJson *item = tjsonCreateObject();
for (int32_t i = 0; i < taosArrayGetSize(pAdList); ++i) {
SJson* item = tjsonCreateObject();
TSDB_CHECK_NULL(item, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddItemToArray(items1, item), &lino, _OVER);
TSDB_CHECK_NULL(item, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddItemToArray(items1, item), &lino, _OVER);
SAnodeAlgo *p = taosArrayGet(pAdList, i);
TSDB_CHECK_NULL(p, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddStringToObject(item, "name", p->name), &lino, _OVER);
SAnodeAlgo* p = taosArrayGet(pAdList, i);
TSDB_CHECK_NULL(p, code, lino, _OVER, terrno);
TAOS_CHECK_GOTO(tjsonAddStringToObject(item, "name", p->name), &lino, _OVER);
}
}
_OVER: