Skip to content

Commit

Permalink
fix: cleanup message logging, allow slightly longer for ACK timeout (#25
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cryptk committed May 30, 2023
1 parent 3ae891d commit 68f5fdc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyomnilogic_local/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def __bytes__(self) -> bytes:

def __repr__(self) -> str:
if self.compressed or self.type is MessageType.MSP_BLOCKMESSAGE:
return f"ID: {self.id}, Type: {self.type}, Compressed: {self.compressed}"
return f"ID: {self.id}, Type: {self.type}, Compressed: {self.compressed}, Body: {self.payload[:-1].decode('utf-8')}"
return f"ID: {self.id}, Type: {self.type.name}, Compressed: {self.compressed}"
return f"ID: {self.id}, Type: {self.type.name}, Compressed: {self.compressed}, Body: {self.payload[:-1].decode('utf-8')}"

@classmethod
def from_bytes(cls, data: bytes) -> Self:
Expand Down Expand Up @@ -131,7 +131,7 @@ async def _ensure_sent(self, message: OmniLogicMessage, max_attempts: int = 5) -

# Wait for a bit to either receive an ACK for our message, otherwise, we retry delivery
try:
await asyncio.wait_for(self._wait_for_ack(message.id), 0.25)
await asyncio.wait_for(self._wait_for_ack(message.id), 0.5)
return
except TimeoutError as exc:
if attempt < 4:
Expand Down

0 comments on commit 68f5fdc

Please sign in to comment.