Description
There is a recent commit 48aba3c which causes a lengthy delay in calls to .loop() in one of my test programs, which did not occur prior to this commit.
EDIT: Apologies, I made a mistake in identifying a specific commit. The commit tagged 5.5.2 shows the lengthy delay, and commits tagged 5.5.1 and 5.5.0 do not show the problem.
I am using an ethernet featherwing attached to a rp2040 feather. Running the test code below (a modified version of example programs for minimqtt) before and after commit shows a lengthy (several second) delay introduced in calls to .loop() (the third last line in code). Whereas prior to this commit, loop returns quickly; i.e., on order of specified timeout.
I'm running circuitpython 7.3.3, but I get identical slow behaviour with 8.0.0 and most recent version of minimqtt.
import board
import busio
from digitalio import DigitalInOut
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket
import adafruit_minimqtt.adafruit_minimqtt as MQTT
print("starting")
cs = DigitalInOut(board.D10)
spi_bus = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
print("Finished spi")
# Initialize ethernet interface with DHCP
eth = WIZNET5K(spi_bus, cs)
print("My IP address is:", eth.pretty_ip(eth.ip_address))
print("Finished ethernet")
# pylint: disable=unused-argument
def message(client, feed_id, payload):
# Message function will be called when a subscribed feed has a new value.
# The feed_id parameter identifies the feed, and the payload parameter has
# the new value.
print("Feed {0} received new value: {1}".format(feed_id, payload))
# Initialize MQTT interface with the ethernet interface
MQTT.set_socket(socket, eth)
# Initialize a new MQTT Client object
mqtt_client = MQTT.MQTT(
broker="192.168.1.200",
port = 1883,
is_ssl = False
# username=secrets["aio_username"],
# password=secrets["aio_key"],
)
print("trying to connect")
mqtt_client.connect()
i=0
while True:
mqtt_client.loop(timeout=0.01)
i += 1
print(i)
'''