wialon / gmqtt

Python MQTT v5.0 async client
MIT License
396 stars 52 forks source link

won't remove resend messages if PUBREC is faster than message pushed #136

Closed sunnyanthony closed 2 years ago

sunnyanthony commented 2 years ago

https://github.com/wialon/gmqtt/blob/50bc08300d858c6e28d4975a989be578954bf7bd/gmqtt/client.py#L197-L198 The order will cause _handle_pubrec_packet does not properly remove messages. If client sends packages out and very soon to get PUBREC, it will not remove this message before pushing back.

The suggestion:

-  await asyncio.sleep(0.001) 
   await self._persistent_storage.push_message(mid, package)
+  await asyncio.sleep(0.001) 
Lenka42 commented 2 years ago

@sunnyanthony thanks for the issue and PR. Seems legit :+1: check version 0.6.11