adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT

Enhance loop() to be more resilient

Open
#161 0 comments 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
81
Forks
52
PR merge metrics
No merged PRs in 30d

Description

The `loop()` method seems to cause a lot of confusion regarding its purpose, invocation, and operation. I was discussing with @dhalbert how to improve this and have some ideas...

This issue proposes:
* We create a new method (`network_loop()`. This method handles:
* WiFi network connectivity (are we connected prior to polling? What do we do if the WiFi is disconnected during the `while True`)
* MQTT broker connectivity (are we still connected to the broker, prior to calling `loop()`
* MQTT network `loop()` polling
* Handling failures within a MQTT `loop()` call

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing `loop()` implementation and how callers use it, then trace the WiFi and MQTT connection checks around the `while True` polling flow. The proposed `network_loop()` should define connectivity checks and failure handling for MQTT polling, but this issue names no files or tests and leaves the design open.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.