From bf48419dff643f26013a2216780fce08b79187a8 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 8 Dec 2022 22:18:08 +0800 Subject: [PATCH] change trim cron --- source/dnode/mgmt/mgmt_dnode/src/dmWorker.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index 30ef7b9542..80c040a5e8 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -20,7 +20,9 @@ static void *dmStatusThreadFp(void *param) { SDnodeMgmt *pMgmt = param; int64_t lastTime = taosGetTimestampMs(); setThreadName("dnode-status"); - + + const static int16_t TRIM_FREQ = 30; + int32_t trimCount = 0; while (1) { taosMsleep(200); if (pMgmt->pData->dropped || pMgmt->pData->stopped) break; @@ -28,9 +30,13 @@ static void *dmStatusThreadFp(void *param) { int64_t curTime = taosGetTimestampMs(); float interval = (curTime - lastTime) / 1000.0f; if (interval >= tsStatusInterval) { - taosMemoryTrim(0); dmSendStatusReq(pMgmt); lastTime = curTime; + + trimCount = (trimCount + 1) % TRIM_FREQ; + if (trimCount == 0) { + taosMemoryTrim(0); + } } } -- GitLab