提交 05c35628 编写于 作者: B Bomin Zhang

td-1033: fix high cpu usage

上级 1e5f3c50
...@@ -235,7 +235,9 @@ static void* telemetryThread(void* param) { ...@@ -235,7 +235,9 @@ static void* telemetryThread(void* param) {
} }
int startAt = taosGetTimestampSec(); int startAt = taosGetTimestampSec();
struct timespec timeout = {.tv_sec = timeToWait, .tv_nsec = 0}; struct timespec timeout = {.tv_sec = 0, .tv_nsec = 0};
clock_gettime(CLOCK_REALTIME, &timeout);
timeout.tv_sec += timeToWait;
if (sem_timedwait(&tsExitSem, &timeout) == 0) { if (sem_timedwait(&tsExitSem, &timeout) == 0) {
break; break;
} }
...@@ -279,4 +281,4 @@ void dnodeCleanupTelemetry() { ...@@ -279,4 +281,4 @@ void dnodeCleanupTelemetry() {
pthread_join(tsTelemetryThread, NULL); pthread_join(tsTelemetryThread, NULL);
sem_destroy(&tsExitSem); sem_destroy(&tsExitSem);
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册