mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-23 20:47:59 +02:00
fix: check if loop is running in SocketIOHandler
Before emitting sio events in the SocketIOHandler, I have to check if the loop is actually still running. This caused issues with pytest as pytest was tearing down asyncio tasks and stopping the loop, while the sio handler was still trying to send those logs to the sio clients.
This commit is contained in:
@ -165,6 +165,7 @@ class SocketIOHandler(logging.Handler):
|
||||
log_entry = self.format(record)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
if loop.is_running():
|
||||
loop.create_task(
|
||||
self._sio.emit(
|
||||
"log",
|
||||
|
Reference in New Issue
Block a user