I'm using gunicorn with uvicorn.workers.UvicornWorker and have set max_requests to recycle worker processes and avoid memory leaks.
My Application is FastAPI, but also mounts a legacy Django Application with
app.mount(..., WSGIMiddleware(django_app))
It's basically working fine, but I noticed that max_requests only affects the FastAPI Endpoints.
- when only sending requests to FastAPI Endpoints, worker processes are recycled as expected
- when only sending requests to Django Endoints, worker processes are never recycled
Why is this, and is there a way to work around it ?