From ac6d031e62fcda4eff8a305e5dddf69b30ac1fc7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 21 Aug 2023 17:56:35 +0800 Subject: [PATCH] fix:do not send unsubscribe msg to taosd if subscribe failed --- source/client/src/clientTmq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index b4168046f4..e861bd4b92 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -985,6 +985,10 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) { int32_t tmq_unsubscribe(tmq_t* tmq) { if(tmq == NULL) return TSDB_CODE_INVALID_PARA; + if (tmq->status != TMQ_CONSUMER_STATUS__READY) { + tscInfo("consumer:0x%" PRIx64 " not in ready state, unsubscribe it directly", tmq->consumerId); + return 0; + } if (tmq->autoCommit) { int32_t rsp = tmq_commit_sync(tmq, NULL); if (rsp != 0) {