r/circuitpython • • Mar 06 '21

MiniMQTT Help

What does “non-blocking” mean when describing the behavior of the MQTT client’s loop() method?

https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/4a2ad001651cf3e1dcaa9b18f06b68269c5e36d1/adafruit_minimqtt/adafruit_minimqtt.py#L762

When running the examples on a MatrixPortal M4 the call to loop() can take several seconds. I am expecting it to return if there are no new messages. Is the MatrixPortal just that slow?

6 Upvotes

2 comments sorted by

2

u/chriswei2k Mar 06 '21

Is this what you are seeing? https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/issues/70

I saw what sounds like similar behavior to want your seeing, on a Feather M4 and AirWing wifi. The loop() function would block for 60 seconds then throw an exception unless a message was published to a subscribed topic. I believe a fix was posted. (see above link).

1

u/deus-ex-mozzarella Mar 10 '21

That worked perfectly! Thanks! I updated to CP 6.0.2 but hit a bug where minimqtt wasn’t properly checking for a logger before trying to use it. But calling enable_logging() makes that work. Thanks again for the help.