mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-21 19:51:28 +00:00
try another way to stop a leak
This commit is contained in:
parent
cd83f18ee8
commit
77132d8ce3
|
@ -21,12 +21,17 @@ async def log_stream() -> AsyncGenerator[LogEntry, None]:
|
||||||
|
|
||||||
asyncio.get_event_loop().add_reader(j, lambda: asyncio.ensure_future(callback()))
|
asyncio.get_event_loop().add_reader(j, lambda: asyncio.ensure_future(callback()))
|
||||||
|
|
||||||
while True:
|
try:
|
||||||
entry = await queue.get()
|
while True:
|
||||||
try:
|
entry = await queue.get()
|
||||||
yield LogEntry(entry)
|
try:
|
||||||
except Exception:
|
yield LogEntry(entry)
|
||||||
asyncio.get_event_loop().remove_reader(j)
|
except Exception:
|
||||||
j.close()
|
asyncio.get_event_loop().remove_reader(j)
|
||||||
return
|
j.close()
|
||||||
queue.task_done()
|
return
|
||||||
|
queue.task_done()
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
asyncio.get_event_loop().remove_reader(j)
|
||||||
|
j.close()
|
||||||
|
return
|
||||||
|
|
Loading…
Reference in a new issue