adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT

`reconnect()` loses QoS on subscribed topics

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

Description

The class-level variable `_subscribed_topics` is used to track what we're interested in:
https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/bf47a0e613235a97346ab0f7b20d727d666c2227/adafruit_minimqtt/adafruit_minimqtt.py#L244

In `subscribe()`, the subscription is noted in the class-level variable (nit: `list(set(...` to deduplicate):
https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/bf47a0e613235a97346ab0f7b20d727d666c2227/adafruit_minimqtt/adafruit_minimqtt.py#L837-L840

In `reconnect()`, subscriptions are re-established... but lo, they don't have any way to know `qos`, so they can't re-subscribe with their original QoS.
https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/bf47a0e613235a97346ab0f7b20d727d666c2227/adafruit_minimqtt/adafruit_minimqtt.py#L970-L975

Contributor guide

No contributing guide indexed for this repository

Research direction

Read adafruit_minimqtt/adafruit_minimqtt.py at the _subscribed_topics definition and the subscribe() and reconnect() methods referenced in the issue. Trace how subscribe() records topics and how reconnect() restores them. Done means reconnect() re-subscribes each topic with the QoS originally provided to subscribe().

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.