Skip to content

Commit 8014cd1

Browse files
committed
Merge branch 'diagnostics' of github.com:allenporter/python-roborock into diagnostics
2 parents f5a0bb4 + 10aecd4 commit 8014cd1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

roborock/devices/device_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
UserData,
1717
)
1818
from roborock.devices.device import DeviceReadyCallback, RoborockDevice
19-
from roborock.exceptions import RoborockException
2019
from roborock.diagnostics import Diagnostics
20+
from roborock.exceptions import RoborockException
2121
from roborock.map.map_parser import MapParserConfig
2222
from roborock.mqtt.roborock_session import create_lazy_mqtt_session
2323
from roborock.mqtt.session import MqttSession

roborock/mqtt/roborock_session.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ async def _mqtt_client(self, params: MqttParams) -> aiomqtt.Client:
240240
async with self._client_lock:
241241
self._client = client
242242
for topic in self._client_subscribed_topics:
243+
self._diagnostics.increment("resubscribe")
243244
_LOGGER.debug("Re-establishing subscription to topic %s", topic)
244245
# TODO: If this fails it will break the whole connection. Make
245246
# this retry again in the background with backoff.
@@ -321,6 +322,8 @@ def delayed_unsub():
321322
unsub() # Remove the callback from CallbackMap
322323
# If no more callbacks for this topic, start idle timer
323324
if not self._listeners.get_callbacks(topic):
325+
self._diagnostics.increment("unsubscribe_idle_start")
326+
_LOGGER.debug("Unsubscribing topic %s, starting idle timer", topic)
324327
schedule_unsubscribe()
325328
else:
326329
_LOGGER.debug("Unsubscribing topic %s, still have active callbacks", topic)

0 commit comments

Comments
 (0)