Skip to content

Commit ff6f991

Browse files
authored
Merge pull request #205 from LelandSindt/main
Add `timeout` value.
2 parents 048d9c0 + c493c7b commit ff6f991

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/native_networking/minimqtt_adafruitio_native_networking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def message(client, topic, message):
8989
photocell_val = 0
9090
while True:
9191
# Poll the message queue
92-
mqtt_client.loop()
92+
mqtt_client.loop(timeout=1)
9393

9494
# Send a new message
9595
print(f"Sending photocell value: {photocell_val}...")

examples/native_networking/minimqtt_pub_sub_blocking_native_networking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def message(client, topic, message):
9191
# NOTE: Network reconnection is handled within this loop
9292
while True:
9393
try:
94-
mqtt_client.loop()
94+
mqtt_client.loop(timeout=1)
9595
except (ValueError, RuntimeError) as e:
9696
print("Failed to get data, retrying\n", e)
9797
wifi.reset()

examples/native_networking/minimqtt_pub_sub_blocking_topic_callbacks_native_networking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def on_message(client, topic, message):
103103
# NOTE: NO code below this loop will execute
104104
while True:
105105
try:
106-
client.loop()
106+
client.loop(timeout=1)
107107
except (ValueError, RuntimeError) as e:
108108
print("Failed to get data, retrying\n", e)
109109
wifi.reset()

0 commit comments

Comments
 (0)