What is the best way to limit the number of concurrent requests each sanic worker is working on?
Something similar to uvicorn’s --limit-concurrency
I would create maybe a semaphore on the app context, then decrement it in a signal handler (Event.HTTP_LIFECYCLE_REQUEST
)
LMK if you want me to share a snippet.
You could do something similar with connections too, just on an earlier signal event.