You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My simple script for test without any logic only get message and send message. Hangs my script on wait_for_publish() or if i set ex. wait_for_publish(1) after 1 seconds goes further but message is published on server but info.is_published() return False
I made some tests and if I turn off client.loop_forever() and only make publish_data_to_broker() then everything works
Why wait_for_publish not work and is_publish return False with loop_forever ?
Is it possible to use wait_for_publish with loop or should i use threads?
Ubuntu server 24.04.01LTS
Python 3.10.12
paho-mqtt 2.1.0
mosquitto server 2.0.20
The text was updated successfully, but these errors were encountered:
on_message is called from within the network loop, if your handler code blocks, then the network loop is blocked (so nothing will be sent/received). You are calling wait_for_publish, which will block until the message is published, but as this blocks the network loop the message will not be sent (so you have a deadlock).
I'd suggest moving the stuff that needs to be done when the publish is complete off to an on_publish() callback. The alternative would be to perform the operation in a seperate thread.
My simple script for test without any logic only get message and send message. Hangs my script on wait_for_publish() or if i set ex. wait_for_publish(1) after 1 seconds goes further but message is published on server but info.is_published() return False
I made some tests and if I turn off client.loop_forever() and only make publish_data_to_broker() then everything works
Why wait_for_publish not work and is_publish return False with loop_forever ?
Is it possible to use wait_for_publish with loop or should i use threads?
Ubuntu server 24.04.01LTS
Python 3.10.12
paho-mqtt 2.1.0
mosquitto server 2.0.20
The text was updated successfully, but these errors were encountered: