Skip to content

Commit b7a55b6

Browse files
committed
adding loop timeout gt zero
if not set, loop() default timeout is zero and MQTT default loop() timeout is one, which will raise an MMQTTException.
1 parent 4ea8273 commit b7a55b6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/aws_iot_native_networking.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ def message(client, topic, msg):
118118
# NOTE: NO code below this loop will execute
119119
# NOTE: Network reconnection is NOT handled within this loop
120120
while True:
121-
aws_iot.loop()
121+
aws_iot.loop(10)
122122

123123
time.sleep(1)

examples/aws_iot_shadows.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ def message(client, topic, msg):
163163
# Pump the message loop forever, all events
164164
# are handled in their callback handlers
165165
# while True:
166-
# aws_iot.loop()
166+
# aws_iot.loop(10)
167167

168168
# Start a blocking message loop...
169169
# NOTE: NO code below this loop will execute
170170
# NOTE: Network reconnection is handled within this loop
171171
while True:
172172
try:
173-
aws_iot.loop()
173+
aws_iot.loop(10)
174174
except (ValueError, RuntimeError) as e:
175175
print("Failed to get data, retrying\n", e)
176176
wifi.reset()

examples/aws_iot_simpletest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ def message(client, topic, msg):
160160
# Pump the message loop forever, all events
161161
# are handled in their callback handlers
162162
# while True:
163-
# aws_iot.loop()
163+
# aws_iot.loop(10)
164164

165165
# Start a blocking message loop...
166166
# NOTE: NO code below this loop will execute
167167
# NOTE: Network reconnection is handled within this loop
168168
while True:
169169
try:
170-
aws_iot.loop()
170+
aws_iot.loop(10)
171171
except (ValueError, RuntimeError) as e:
172172
print("Failed to get data, retrying\n", e)
173173
wifi.reset()

0 commit comments

Comments
 (0)