fixes
This commit is contained in:
parent
18e444d751
commit
a2372c5eaa
1 changed files with 12 additions and 0 deletions
12
app.py
12
app.py
|
|
@ -360,6 +360,18 @@ async def lifespan(app: FastAPI):
|
||||||
eventManager.set_event_loop(main_loop)
|
eventManager.set_event_loop(main_loop)
|
||||||
from modules.workflows.scheduler.mainScheduler import setMainLoop as setSchedulerMainLoop
|
from modules.workflows.scheduler.mainScheduler import setMainLoop as setSchedulerMainLoop
|
||||||
setSchedulerMainLoop(main_loop)
|
setSchedulerMainLoop(main_loop)
|
||||||
|
|
||||||
|
# Suppress noisy ConnectionResetError from ProactorEventLoop on Windows
|
||||||
|
# when clients (browsers) close connections abruptly. This is a known
|
||||||
|
# asyncio issue on Windows: https://bugs.python.org/issue39010
|
||||||
|
def _suppressClientDisconnect(loop, ctx):
|
||||||
|
exc = ctx.get("exception")
|
||||||
|
if isinstance(exc, ConnectionResetError):
|
||||||
|
return
|
||||||
|
if isinstance(exc, ConnectionAbortedError):
|
||||||
|
return
|
||||||
|
loop.default_exception_handler(ctx)
|
||||||
|
main_loop.set_exception_handler(_suppressClientDisconnect)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
eventManager.start()
|
eventManager.start()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue