Skip to content

Commit c813b1f

Browse files
author
brentru
committed
remove blocking
1 parent 305cd9d commit c813b1f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

examples/gc_iot_core_simpletest.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,15 @@ def message(client, topic, msg):
128128
# while True:
129129
# google_mqtt.loop()
130130

131-
# Attempt to loop forever and handle network disconnection
132-
google_mqtt.loop_blocking()
131+
# Start a blocking message loop...
132+
# NOTE: NO code below this loop will execute
133+
# NOTE: Network reconnection is handled within this loop
134+
while True:
135+
try:
136+
google_mqtt.loop()
137+
except (ValueError, RuntimeError) as e:
138+
print("Failed to get data, retrying\n", e)
139+
wifi.reset()
140+
google_mqtt.reconnect()
141+
continue
142+
time.sleep(1)

0 commit comments

Comments
 (0)