Skip to content

Commit

Permalink
Merge pull request #205 from LelandSindt/main
Browse files Browse the repository at this point in the history
Add `timeout` value.
  • Loading branch information
FoamyGuy authored Mar 4, 2024
2 parents 048d9c0 + c493c7b commit ff6f991
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def message(client, topic, message):
photocell_val = 0
while True:
# Poll the message queue
mqtt_client.loop()
mqtt_client.loop(timeout=1)

# Send a new message
print(f"Sending photocell value: {photocell_val}...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def message(client, topic, message):
# NOTE: Network reconnection is handled within this loop
while True:
try:
mqtt_client.loop()
mqtt_client.loop(timeout=1)
except (ValueError, RuntimeError) as e:
print("Failed to get data, retrying\n", e)
wifi.reset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def on_message(client, topic, message):
# NOTE: NO code below this loop will execute
while True:
try:
client.loop()
client.loop(timeout=1)
except (ValueError, RuntimeError) as e:
print("Failed to get data, retrying\n", e)
wifi.reset()
Expand Down

0 comments on commit ff6f991

Please sign in to comment.