Skip to content

Commit 7e4c422

Browse files
authored
Add comment explaining why we wait before reading
1 parent 96d8ace commit 7e4c422

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

adafruit_mcp2515/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,10 @@ def unread_message_count(self):
406406
Returns:
407407
int: The unread message count
408408
"""
409+
410+
# Wait until the queue is empty before reading from the MCP2515 again,
411+
# otherwise we'll fill it faster than what the user app can process
412+
# and quickly run out of memory.
409413
if len(self._unread_message_queue) == 0:
410414
self._read_from_rx_buffers()
411415

0 commit comments

Comments
 (0)