Skip to content

Commit 7b8a3bb

Browse files
committed
chore: fix message count to increase on total chunck message
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
1 parent e0b1e71 commit 7b8a3bb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/hiero_sdk_python/query/topic_message_query.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,11 @@ def _build_query_request(self, state: SubscriptionState) -> mirror_proto.Consens
184184

185185
def _handle_response(self, response, state: SubscriptionState, on_message: Callable[[TopicMessage], None]) -> None:
186186
"""Handles single or chunked messages."""
187-
state.count += 1
188187
state.last_message = response
189188

190189
if not self._chunking_enabled or not response.HasField("chunkInfo") or response.chunkInfo.total <= 1:
190+
state.count += 1
191+
191192
message = TopicMessage.of_single(response)
192193
on_message(message)
193194
return
@@ -201,8 +202,9 @@ def _handle_response(self, response, state: SubscriptionState, on_message: Calla
201202
chunks.append(response)
202203

203204
if len(chunks) == response.chunkInfo.total:
204-
del state.pending_messages[initial_tx_id]
205+
state.count += 1
205206

207+
del state.pending_messages[initial_tx_id]
206208
message = TopicMessage.of_many(chunks)
207209
on_message(message)
208210

0 commit comments

Comments
 (0)