lifecycle: use custom worker class
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
bafeff7306
commit
552ddda909
|
@ -16,7 +16,7 @@ try:
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
worker_class = "uvicorn.workers.UvicornWorker"
|
worker_class = "lifecycle.worker.DjangoUvicornWorker"
|
||||||
# Docker containers don't have /tmp as tmpfs
|
# Docker containers don't have /tmp as tmpfs
|
||||||
if os.path.exists("/dev/shm"): # nosec
|
if os.path.exists("/dev/shm"): # nosec
|
||||||
worker_tmp_dir = "/dev/shm" # nosec
|
worker_tmp_dir = "/dev/shm" # nosec
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
"""Uvicorn worker"""
|
||||||
|
from uvicorn.workers import UvicornWorker
|
||||||
|
|
||||||
|
|
||||||
|
class DjangoUvicornWorker(UvicornWorker):
|
||||||
|
"""Custom configured Uvicorn Worker without lifespan"""
|
||||||
|
|
||||||
|
CONFIG_KWARGS = {
|
||||||
|
"loop": "uvloop",
|
||||||
|
"http": "httptools",
|
||||||
|
"lifespan": "off",
|
||||||
|
"ws": "wsproto",
|
||||||
|
}
|
Reference in New Issue