Skip to content

Commit

Permalink
Merge pull request #163 from Luos-io/fix/full_queue_warning
Browse files Browse the repository at this point in the history
Ignore void messages
  • Loading branch information
JeromeGalan authored Oct 10, 2022
2 parents 89ef8ba + d8131e3 commit 156e53a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pyluos/io/serial_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, host, baudrate=None):
self._serial = _serial.Serial(host, baudrate)
self._serial.flush()

self._msg = queue.Queue(100)
self._msg = queue.Queue(500)
self._running = True

self._poll_loop = Thread(target=self._poll)
Expand Down Expand Up @@ -112,7 +112,13 @@ def extract_line(s):
return extract_line(s[H+1:])
else:
# Footer is ok
return s[data_start:data_end], s[data_end + 1:]
data = s[data_start:data_end]
if data == b'{}\n':
# Datas are void
return b'', s[data_end + 1:]
else:
# Datas are not void
return data, s[data_end + 1:]

period = 1 / self.poll_frequency
buff = b''
Expand Down
2 changes: 1 addition & 1 deletion pyluos/io/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, host, port=9342):
self._ws = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._ws.connect((host, port))

self._msg = queue.Queue(100)
self._msg = queue.Queue(500)
self._running = True

self._poll_loop = Thread(target=self._poll)
Expand Down

0 comments on commit 156e53a

Please sign in to comment.