Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timeout value. #205

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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 @@ -92,7 +92,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 @@ -104,7 +104,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
Loading