Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion adafruit_mcp2515/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,12 @@ def unread_message_count(self):
Returns:
int: The unread message count
"""
self._read_from_rx_buffers()

# Wait until the queue is empty before reading from the MCP2515 again,
# otherwise we'll fill it faster than what the user app can process
# and quickly run out of memory.
if len(self._unread_message_queue) == 0:
self._read_from_rx_buffers()

return len(self._unread_message_queue)

Expand Down
Loading