Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add custom uvicorn worker with lifespan protocol disabled (#8509)
GrzegorzKowalike9e74c0bf05d
diff --git a/.isort.cfg b/.isort.cfgindex 0e4181fd00..7ade008a8d 100644--- a/.isort.cfg+++ b/.isort.cfg@@ -1,2 +1,2 @@[settings]-known_third_party = Adyen,PIL,authorizenet,babel,boto3,botocore,braintree,celery,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,urllib3,versatileimagefield,weasyprint+known_third_party = Adyen,PIL,authorizenet,babel,boto3,botocore,braintree,celery,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,urllib3,uvicorn,versatileimagefield,weasyprintdiff --git a/Dockerfile b/Dockerfileindex d04d9afe29..78e106ef1c 100644--- a/Dockerfile+++ b/Dockerfile@@ -65,4 +65,4 @@ GraphQL, Django, and ReactJS."org.opencontainers.image.authors="Saleor Commerce (https://saleor.io)" \org.opencontainers.image.licenses="BSD 3"-CMD ["gunicorn", "--bind", ":8000", "--workers", "4", "--worker-class", "uvicorn.workers.UvicornWorker", "saleor.asgi:application"]+CMD ["gunicorn", "--bind", ":8000", "--workers", "4", "--worker-class", "saleor.asgi.gunicorn_worker.UvicornWorker", "saleor.asgi:application"]diff --git a/saleor/asgi/gunicorn_worker.py b/saleor/asgi/gunicorn_worker.pynew file mode 100644index 0000000000..9a65b6f69a--- /dev/null+++ b/saleor/asgi/gunicorn_worker.py@@ -0,0 +1,7 @@+from uvicorn.workers import UvicornWorker as BaseUvicornWorker+++class UvicornWorker(BaseUvicornWorker):+ # Override default config args, that cannot be passed as gunicorn parameters,+ # to disable lifespan, not supported by django+ CONFIG_KWARGS = {"loop": "uvloop", "http": "httptools", "lifespan": "off"}