Add custom Uvicorn worker for Langflow application
This commit is contained in:
parent
d8162f5dc2
commit
23e08f1f5c
1 changed files with 6 additions and 1 deletions
|
|
@ -1,11 +1,16 @@
|
||||||
from gunicorn.app.base import BaseApplication # type: ignore
|
from gunicorn.app.base import BaseApplication # type: ignore
|
||||||
|
from uvicorn.workers import UvicornWorker
|
||||||
|
|
||||||
|
|
||||||
|
class LangflowUvicornWorker(UvicornWorker):
|
||||||
|
CONFIG_KWARGS = {"loop": "asyncio"}
|
||||||
|
|
||||||
|
|
||||||
class LangflowApplication(BaseApplication):
|
class LangflowApplication(BaseApplication):
|
||||||
def __init__(self, app, options=None):
|
def __init__(self, app, options=None):
|
||||||
self.options = options or {}
|
self.options = options or {}
|
||||||
|
|
||||||
self.options["worker_class"] = "uvicorn.workers.UvicornWorker"
|
self.options["worker_class"] = "langflow.server.LangflowUvicornWorker"
|
||||||
self.application = app
|
self.application = app
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue