Skip to content

reconnect() loses QoS on subscribed topics #252

@BMDan

Description

@BMDan

The class-level variable _subscribed_topics is used to track what we're interested in:

self._subscribed_topics: List[str] = []

In subscribe(), the subscription is noted in the class-level variable (nit: list(set(... to deduplicate):

for t, q in topics:
if self.on_subscribe is not None:
self.on_subscribe(self, self.user_data, t, q)
self._subscribed_topics.append(t)

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.

if resub_topics and subscribed_topics:
self.logger.debug("Attempting to resubscribe to previously subscribed topics.")
self._subscribed_topics = []
while subscribed_topics:
feed = subscribed_topics.pop()
self.subscribe(feed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions