Skip to content

Commit 2d842f9

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

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,12 +184,13 @@ 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:
191190
message = TopicMessage.of_single(response)
192191
on_message(message)
192+
193+
state.count += 1
193194
return
194195

195196
initial_tx_id = TransactionId._from_proto(response.chunkInfo.initialTransactionID)
@@ -202,10 +203,11 @@ def _handle_response(self, response, state: SubscriptionState, on_message: Calla
202203

203204
if len(chunks) == response.chunkInfo.total:
204205
del state.pending_messages[initial_tx_id]
205-
206206
message = TopicMessage.of_many(chunks)
207207
on_message(message)
208208

209+
state.count += 1
210+
209211
def subscribe(
210212
self,
211213
client: Client,

0 commit comments

Comments
 (0)