listener: don't add elements if queue is full

When Solaar is loaded, if a large number of events happen,
it will lose the register events, as the queue size is too
small (16). So, check if the queue is full, in order to
avoid losing those important events.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Mauro Carvalho Chehab 2017-09-11 10:31:37 -03:00
parent a4b7194490
commit 632d8804be
1 changed files with 2 additions and 1 deletions

View File

@ -222,7 +222,8 @@ class EventsListener(_threading.Thread):
if self._active: # and _threading.current_thread() == self:
# if _log.isEnabledFor(_DEBUG):
# _log.debug("queueing unhandled %s", n)
self._queued_notifications.put(n)
if not self._queued_notifications.full():
self._queued_notifications.put(n)
def __bool__(self):
return bool(self._active and self.receiver)