From bbecb9e7a98241f87bfbd2c8478a446cb5344e23 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 12 Oct 2024 11:16:07 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/3.0' into enh/opt-transport --- source/libs/transport/src/transCli.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e7bf94cd31..8f64cbb691 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -479,14 +479,14 @@ int8_t cliMayRecycleConn(SCliConn* conn) { int32_t code = 0; SCliThrd* pThrd = conn->hostThrd; - // code = balanceConnHeapCache(pThrd->connHeapCache, conn); - // if (code != 0) { - // tDebug("%s conn %p failed to balance heap cache", CONN_GET_INST_LABEL(conn), conn); - // } if (transQueueSize(&conn->reqsToSend) == 0 && transQueueSize(&conn->reqsSentOut) == 0 && taosHashGetSize(conn->pQTable) == 0) { code = delConnFromHeapCache(pThrd->connHeapCache, conn); - if (code != 0) { + if (code == TSDB_CODE_RPC_ASYNC_IN_PROCESS) { + tError("%s conn %p failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn, + tstrerror(code)); + return 0; + } else { tError("%s conn %p failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } @@ -3878,6 +3878,7 @@ int32_t transHeapDelete(SHeap* heap, SCliConn* p) { if (p->connnected == 0) { transHeapUpdateFailTs(heap, p); } + if (p->inHeap == 0) { tTrace("failed to del conn %p since not in heap", p); return 0; @@ -3885,7 +3886,7 @@ int32_t transHeapDelete(SHeap* heap, SCliConn* p) { int64_t now = taosGetTimestampMs(); if (p->forceDelFromHeap == 0 && now - p->lastAddHeapTime < 10000) { tTrace("conn %p not added/delete to heap frequently", p); - return 0; + return TSDB_CODE_RPC_ASYNC_IN_PROCESS; } }