wialon/gmqtt

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

sunnyanthony opened this issue · 1 comments

gmqtt/gmqtt/client.py

Lines 197 to 198 in 50bc083

await asyncio.sleep(0.001)
await self._persistent_storage.push_message(mid, package)

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) 

@sunnyanthony thanks for the issue and PR. Seems legit 👍 check version 0.6.11