homeassistant-elasticsearch
homeassistant-elasticsearch copied to clipboard
[2.0] Use of sync queue implementation and blocking queue calls
The Queue implementation we use is not async safe and so we should switch to asyncio.queue instead of queue to avoid blocking. The queue implementations are highly compatible with the only change being adding await before commands that change the queue.
In addition, the various queue commands we use, get and put technically block in certain situations. put blocks if there is no more capacity in the queue (we currently use an unlimited capacity queue) and get blocks if there are no more items in the queue. We only call get when the queue is not empty so this shouldn't be a problem but switching to non-blocking get is probably the safer move.
Thanks for raising this - I'm in favor of this change