SocketIO ASGIApp (FastAPI) + Gunicorn Process Manager Example for long running Job #880
Unanswered
Udayaprasad
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Have you read the documentation? Gunicorn's load balancer is very simplisitic and cannot be configured to work with this package, so you cannot use more then one worker per gunicorn instance. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @miguelgrinberg,
ASGI Server App details.
The Server app runs for a long time (Generally 5-10 mins), We don't have the option to use WebSocket protocol due to some restrictions at the customer side, so we have opted SocketIO protocol by maintaining client-specific sid for each request. Our existing FastAPI framework uses Gunicorn to manage concurrent tasks (Inside a POD), due to this long-running time, every subsequent request is going to a different worker context with different sid, so ultimately the client application has no idea about the initially assigned sid.
Due to the above situation, there are multiple duplicate runs that happened on the server-side.
Do you have any example code to work with this? I also see that on client disconnect (Using uvicron server), the server is displaying the disconnected message, but it is not stopping the client request (Thread is running).
Packages used.
Code snippet for both Server (Using uvicorn server - for Thread not stopping even after client disconnect problem) and Client.
Thanks,
Uday
Beta Was this translation helpful? Give feedback.
All reactions