Есть такой оверрайд для подсистемы логов:
def emit(self, record):
"""Overwrite emit method to publish logs to MQTT."""
msg = self.format(record)
try:
self.logs_bridge_queue.put_nowait(msg)
except asyncio.QueueFull:
self.logs_bridge_queue.get_nowait()
self.logs_bridge_queue.put_nowait(msg)
C другой стороны приёмник:
while True:
msg = await self.logs_bridge_queue.get()
В документации написано:
Although asyncio queues are not thread-safe, they are designed to be used specifically in async/await code.
Я не могу понять, что они имеют в виду под thread-safe. Все функции вне асинхронного контекста или только threading?
И чем может грозить использование asyncio.Queue вне асинхронного контекста?