We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6453da4 + 7e4c422 commit ff2aa62Copy full SHA for ff2aa62
adafruit_mcp2515/__init__.py
@@ -406,7 +406,12 @@ def unread_message_count(self):
406
Returns:
407
int: The unread message count
408
"""
409
- self._read_from_rx_buffers()
+
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.
413
+ if len(self._unread_message_queue) == 0:
414
+ self._read_from_rx_buffers()
415
416
return len(self._unread_message_queue)
417
0 commit comments