fix: Enable lifespan=on for uvicorn

Default behavior is "auto", meaning it will try lifespan, but if
something goes wrong, it will silently swallow the issue and won't use
the lifespan handler at all.

This default behavior resulted in silently breaking shutdown handlers
for providers. With this patch, server will fail to start next time
something gets borked in the middleware layer, which is good.

Related: #188

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-03-10 20:03:14 +00:00
parent 056eb68fcc
commit ca571025f5

View file

@ -418,6 +418,7 @@ def main():
"app": app, "app": app,
"host": listen_host, "host": listen_host,
"port": port, "port": port,
"lifespan": "on",
} }
if ssl_config: if ssl_config:
uvicorn_config.update(ssl_config) uvicorn_config.update(ssl_config)