Skip to content

Commit

Permalink
fix: add additional log messages to track down concurrency errors (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
allenporter authored Jan 6, 2025
1 parent e14802c commit d750234
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions roborock/version_1_apis/roborock_client_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ def on_message_received(self, messages: list[RoborockMessage]) -> None:
if isinstance(result, list) and len(result) == 1:
result = result[0]
queue.resolve((result, None))
else:
self._logger.debug("Received response for unknown request id %s", request_id)
else:
try:
data_protocol = RoborockDataProtocol(int(data_point_number))
Expand Down Expand Up @@ -443,10 +445,14 @@ def on_message_received(self, messages: list[RoborockMessage]) -> None:
if isinstance(decompressed, list):
decompressed = decompressed[0]
queue.resolve((decompressed, None))
else:
self._logger.debug("Received response for unknown request id %s", request_id)
else:
queue = self._waiting_queue.get(data.seq)
if queue:
queue.resolve((data.payload, None))
else:
self._logger.debug("Received response for unknown request id %s", data.seq)
except Exception as ex:
self._logger.exception(ex)

Expand Down
1 change: 1 addition & 0 deletions roborock/version_1_apis/roborock_local_client_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def build_roborock_message(
) -> RoborockMessage:
secured = True if method in COMMANDS_SECURED else False
request_id, timestamp, payload = self._get_payload(method, params, secured)
self._logger.debug("Building message id %s for method %s", request_id, method)
request_protocol = RoborockMessageProtocol.GENERAL_REQUEST
message_retry: MessageRetry | None = None
if method == RoborockCommand.RETRY_REQUEST and isinstance(params, dict):
Expand Down
1 change: 1 addition & 0 deletions roborock/version_1_apis/roborock_mqtt_client_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async def _send_command(
# When we have more custom commands do something more complicated here
return await self._get_calibration_points()
request_id, timestamp, payload = self._get_payload(method, params, True)
self._logger.debug("Building message id %s for method %s", request_id, method)
request_protocol = RoborockMessageProtocol.RPC_REQUEST
roborock_message = RoborockMessage(timestamp=timestamp, protocol=request_protocol, payload=payload)
return await self.send_message(roborock_message)
Expand Down

0 comments on commit d750234

Please sign in to comment.