I'm trying to limit Fastapi to process 1 request at a time. And while that request is being executed, other requests gets response that the Server is busy.
Asked
Active
Viewed 1,894 times
1 Answers
0
I cannot understand your requirement but you can either
- Use a library such as https://github.com/long2ice/fastapi-limiter or https://github.com/laurentS/slowapi to handle limits
- Write a middleware that sets a flag in Redis or some other in-memory database, whenever a request comes, check if the flag is True. If True reject the request and if False set it to True and process the request. Set the Flag to False when the Response is sent by the server.

Vismay Tiwari
- 167
- 2