diff --git a/src/tsdb/src/tsdbBuffer.c b/src/tsdb/src/tsdbBuffer.c index 2e097c6ff73543f2dd858f8424b1e942ebdd8c3e..e4795ad1fff0c2ec9646128d5c685a310c963338 100644 --- a/src/tsdb/src/tsdbBuffer.c +++ b/src/tsdb/src/tsdbBuffer.c @@ -121,7 +121,16 @@ SListNode *tsdbAllocBufBlockFromPool(STsdbRepo *pRepo) { while (POOL_IS_EMPTY(pBufPool)) { pRepo->repoLocked = false; +#ifndef NDEBUG + struct timespec abstime = {0, 0}; + clock_gettime(CLOCK_REALTIME, &abstime); + abstime.tv_sec += (60 * 15); + if (pthread_cond_timedwait(&(pBufPool->poolNotEmpty), &(pRepo->mutex), &abstime) != 0) { + assert(0); + } +#else pthread_cond_wait(&(pBufPool->poolNotEmpty), &(pRepo->mutex)); +#endif pRepo->repoLocked = true; }