From 07ad7b39c940e4c0e24a559ed5b16b367efdd2b2 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 6 Mar 2023 10:18:08 +0800 Subject: [PATCH] chore: code optimization --- src/util/src/tidpool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/src/tidpool.c b/src/util/src/tidpool.c index fdb94aa048..2403cd2fbc 100644 --- a/src/util/src/tidpool.c +++ b/src/util/src/tidpool.c @@ -81,11 +81,11 @@ int taosAssignId(void *handle, int id, bool force) { int32_t code = 0; pthread_mutex_lock(&pIdPool->mutex); - if (pIdPool->numOfFree > 0) { + if (force || pIdPool->numOfFree > 0) { if (id > 0 && id < pIdPool->maxId) { if (force || (false == pIdPool->freeList[id - 1])) { + if (false == pIdPool->freeList[id - 1]) --pIdPool->numOfFree; pIdPool->freeList[id - 1] = true; - pIdPool->numOfFree--; } else { code = TSDB_CODE_MND_DUP_TID; } -- GitLab