Skip to content

Commit

Permalink
the queue must go on
Browse files Browse the repository at this point in the history
call .task_done() even when the telegram raised an exception while processing
  • Loading branch information
farmio committed Mar 18, 2021
1 parent 0388b3b commit 541997a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions xknx/core/telegram_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,16 @@ async def _telegram_consumer(self) -> None:
self.xknx.telegrams.task_done()
break

try:
if telegram.direction == TelegramDirection.INCOMING:
if telegram.direction == TelegramDirection.INCOMING:
try:
await self.process_telegram_incoming(telegram)
except XKNXException as ex:
logger.error("Error while processing incoming telegram %s", ex)
finally:
self.xknx.telegrams.task_done()
elif telegram.direction == TelegramDirection.OUTGOING:
self.outgoing_queue.put_nowait(telegram)
# self.xknx.telegrams.task_done() for outgoing is called in _outgoing_rate_limiter.
except XKNXException as ex:
logger.error("Error while processing telegram %s", ex)
elif telegram.direction == TelegramDirection.OUTGOING:
self.outgoing_queue.put_nowait(telegram)
# self.xknx.telegrams.task_done() for outgoing is called in _outgoing_rate_limiter.

async def _outgoing_rate_limiter(self) -> None:
"""Endless loop for processing outgoing telegrams."""
Expand Down

0 comments on commit 541997a

Please sign in to comment.