Back to uvicorn workers from eventlet.

The eventlet API has way too many dependency issues with gunicorn.

Still TODO: Fix or at least mitigate the WSGI workers timeout issue when
they handle websocket connections.
This commit is contained in:
Fabio Manganiello 2023-05-07 15:37:58 +02:00
parent 8102178ba4
commit 692180c653
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
5 changed files with 13 additions and 5 deletions

View File

@ -303,6 +303,7 @@ autodoc_mock_imports = [
'bluetooth_numbers',
'TheengsDecoder',
'simple_websocket',
'uvicorn',
]
sys.path.insert(0, os.path.abspath('../..'))

View File

@ -252,8 +252,8 @@ class HttpBackend(Backend):
kwargs = {
'bind': f'{self.bind_address}:{self.port}',
'workers': (cpu_count() * 2) + 1,
'worker_class': 'eventlet',
'timeout': 60,
'worker_class_str': f'{__package__}.app.UvicornWorker',
'timeout': 30,
}
WSGIApplicationWrapper(f'{__package__}.app:application', kwargs).run()

View File

@ -1,4 +1,11 @@
from typing import Any, Dict
from gunicorn.app.wsgiapp import WSGIApplication
from uvicorn.workers import UvicornWorker as BaseUvicornWorker
class UvicornWorker(BaseUvicornWorker):
CONFIG_KWARGS: Dict[str, Any] = {"loop": "auto", "http": "auto", "lifespan": "on"}
class WSGIApplicationWrapper(WSGIApplication):

View File

@ -5,7 +5,6 @@
alembic
bcrypt
croniter
eventlet
flask
frozendict
gunicorn
@ -22,6 +21,7 @@ rsa
simple_websocket
sqlalchemy
tz
uvicorn
websocket-client
wsproto
zeroconf>=0.27.0

View File

@ -63,10 +63,9 @@ setup(
'alembic',
'bcrypt',
'croniter',
'eventlet',
'flask',
'frozendict',
'gunicorn @ https://github.com/benoitc/gunicorn/tarball/master',
'gunicorn',
'marshmallow',
'marshmallow_dataclass',
'python-dateutil',
@ -78,6 +77,7 @@ setup(
'simple_websocket',
'sqlalchemy',
'tz',
'uvicorn',
'websocket-client',
'wheel',
'wsproto',