td-1033: fix high cpu usage

This commit is contained in:
Bomin Zhang 2020-08-03 09:18:54 +08:00
parent 1e5f3c509c
commit 05c356280e
1 changed files with 4 additions and 2 deletions

View File

@ -235,7 +235,9 @@ static void* telemetryThread(void* param) {
}
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) {
break;
}
@ -279,4 +281,4 @@ void dnodeCleanupTelemetry() {
pthread_join(tsTelemetryThread, NULL);
sem_destroy(&tsExitSem);
}
}
}